From f3de83fb8355ed2f41e6b05d5e84cae5d62a6f9c Mon Sep 17 00:00:00 2001 From: Rico Tiongson Date: Tue, 21 Apr 2020 03:34:48 +0800 Subject: [PATCH] Bugfix keyswipe gesture not passing test --- comfortable-swipe-main.cpp | 2 +- tests/test_swipe.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/comfortable-swipe-main.cpp b/comfortable-swipe-main.cpp index 5c72665..536099a 100644 --- a/comfortable-swipe-main.cpp +++ b/comfortable-swipe-main.cpp @@ -103,7 +103,7 @@ int main() { keyswipe.run(line.data()); } else if (mousehold.run(line.data())) { // only allow keyswipe gestures on mouse move - if (mousehold.button == MOUSE_MOVE) { + if (mousehold.button == MOUSE_NONE || mousehold.button == MOUSE_MOVE) { keyswipe.run(line.data()); } } diff --git a/tests/test_swipe.sh b/tests/test_swipe.sh index 978090b..c862b6b 100755 --- a/tests/test_swipe.sh +++ b/tests/test_swipe.sh @@ -89,12 +89,12 @@ OUTPUT="$(mktemp)" event7 GESTURE_SWIPE_END +2.19s 3 EOF -EXPECTED_OUTPUT="SWIPE left3 -SWIPE right3" +EXPECTED_OUTPUT="SWIPE left3 SWIPE right3" +ACTUAL_OUTPUT="$(cat "$OUTPUT" | xargs)" +echo "My output: $ACTUAL_OUTPUT" +echo "Expected: $EXPECTED_OUTPUT" -echo "$EXPECTED_OUTPUT" - -if [[ "$(cat "$OUTPUT")" == "$EXPECTED_OUTPUT" ]]; then +if [[ "$ACTUAL_OUTPUT" == "$EXPECTED_OUTPUT" ]]; then echo "PASSED" else echo "Did not match expected output:" >&2