From ca11fc49dfd580c625726b7f542b894cbfb83b76 Mon Sep 17 00:00:00 2001 From: beveloper Date: Sun, 29 Sep 2002 16:59:04 +0000 Subject: [PATCH] made movement of mouse cursor a little slower so it is better visible. added a default argument to execute the test 1 time. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1295 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../set_mouse_position_test/test_mouse.cpp | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/tests/kits/game/set_mouse_position_test/test_mouse.cpp b/src/tests/kits/game/set_mouse_position_test/test_mouse.cpp index 6d9c817227..91212e0184 100644 --- a/src/tests/kits/game/set_mouse_position_test/test_mouse.cpp +++ b/src/tests/kits/game/set_mouse_position_test/test_mouse.cpp @@ -9,6 +9,8 @@ #include #include +#define DELAY 2000 + class TestMouse: public BApplication { public: @@ -22,25 +24,37 @@ int32 height, width; void mouse_move_up(int32 x) { for (int32 t = (height); t > 0; t--) + { set_mouse_position(x, t); + snooze(DELAY); + } } void mouse_move_down(int32 x) { for (int32 t = 0; t < (height); t++) + { set_mouse_position(x,t); + snooze(DELAY); + } } void mouse_move_left(int32 y) { for (int32 t = (width); t > 0; t--) + { set_mouse_position(t,y); + snooze(DELAY); + } } void mouse_move_right(int32 y) { for (int32 t = 0; t < (width); t++) + { set_mouse_position(t,y); + snooze(DELAY); + } } void mouse_move_diagonal1(int32 x, int32 y) @@ -51,6 +65,7 @@ void mouse_move_diagonal1(int32 x, int32 y) { t1 = int32(t1 - xmin); set_mouse_position(t1,t2); + snooze(DELAY); } } @@ -62,26 +77,32 @@ void mouse_move_diagonal2(int32 x, int32 y) { t1 = int32(t1 + xplus); set_mouse_position(t1,t2); + snooze(DELAY); } } int main(int argc, char *argv[]) { + int times; + if (argc != 2) { printf("\n Usage: %s param: times, where times is the number of loops \n", argv[0]); + times = 1; } else { - int times = atoi(argv[1]); - if (times > 0) - { - printf("\n times = %d \n", times); - TestMouse test(times); - test.Run(); - } - else printf("\n Error! times must be an integer greater than 0 \n"); + times = atoi(argv[1]); } + + if (times > 0) + { + printf("\n times = %d \n", times); + TestMouse test(times); + test.Run(); + } + else + printf("\n Error! times must be an integer greater than 0 \n"); return 0; }