aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_utils.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-07-05 15:01:12 +0200
committerDavid Robillard <d@drobilla.net>2020-07-05 18:47:37 +0200
commit6c2460414082b989487abcad2ca2018a16ecdbd7 (patch)
treee1b2f29a01098b16483bf744088aca202f903ea0 /test/test_utils.h
parent7d45962ccd6fabcb198599fead141de7cd578916 (diff)
downloadpugl-6c2460414082b989487abcad2ca2018a16ecdbd7.tar.gz
pugl-6c2460414082b989487abcad2ca2018a16ecdbd7.tar.bz2
pugl-6c2460414082b989487abcad2ca2018a16ecdbd7.zip
Add scroll direction field
Diffstat (limited to 'test/test_utils.h')
-rw-r--r--test/test_utils.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/test_utils.h b/test/test_utils.h
index 8668e1d..977fba5 100644
--- a/test/test_utils.h
+++ b/test/test_utils.h
@@ -82,6 +82,25 @@ crossingModeString(const PuglCrossingMode mode)
return "unknown";
}
+static inline const char*
+scrollDirectionString(const PuglScrollDirection direction)
+{
+ switch (direction) {
+ case PUGL_SCROLL_UP:
+ return "up";
+ case PUGL_SCROLL_DOWN:
+ return "down";
+ case PUGL_SCROLL_LEFT:
+ return "left";
+ case PUGL_SCROLL_RIGHT:
+ return "right";
+ case PUGL_SCROLL_SMOOTH:
+ return "smooth";
+ }
+
+ return "unknown";
+}
+
static inline int
printEvent(const PuglEvent* event, const char* prefix, const bool verbose)
{
@@ -118,10 +137,11 @@ printEvent(const PuglEvent* event, const char* prefix, const bool verbose)
event->button.y) +
printModifiers(event->scroll.state));
case PUGL_SCROLL:
- return (PRINT("%sScroll %5.1f %5.1f at " PFMT " ",
+ return (PRINT("%sScroll %5.1f %5.1f (%s) at " PFMT " ",
prefix,
event->scroll.dx,
event->scroll.dy,
+ scrollDirectionString(event->scroll.direction),
event->scroll.x,
event->scroll.y) +
printModifiers(event->scroll.state));