|
7 | 7 | https://github.com/smasherprog/input_lite/blob/master/Test/main.cpp |
8 | 8 |
|
9 | 9 | ```c++ |
10 | | - for (auto c = ' '; c < 127; c++) { |
11 | | - SL::Input_Lite::SendKey(c); |
12 | | - } |
13 | | - |
14 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ENTER); |
15 | | - // UNICODE SUPPORT! |
16 | | - SL::Input_Lite::SendKeyDown((wchar_t)294); // the letter Ħ |
17 | | - SL::Input_Lite::SendKeyDown((wchar_t)274); // the letter Ē |
18 | | - SL::Input_Lite::SendKeyDown((wchar_t)315); // the letter Ļ |
19 | | - SL::Input_Lite::SendKeyDown((wchar_t)315); // the letter Ļ |
20 | | - SL::Input_Lite::SendKeyDown((wchar_t)526); // the letter Ȏ |
21 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ENTER); |
22 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::TAB); |
23 | | - SL::Input_Lite::SendKeys(std::string("this is a std::string")); |
24 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ENTER); |
25 | | - // unicode |
26 | | - SL::Input_Lite::SendKeys(L"ĦĒĻĻȎ"); |
27 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ENTER); |
28 | | - SL::Input_Lite::SendKeys(std::wstring(L"ĦĒĻĻȎ")); |
29 | | - // SPECIAL KEYS |
30 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ENTER); |
31 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::NUMPAD0); |
32 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::CAPSLOCK); |
33 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::TAB); |
34 | | - |
35 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ARROWLEFT); |
36 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ARROWLEFT); |
37 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ARROWLEFT); |
38 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ARROWLEFT); |
39 | | - SL::Input_Lite::SendKey(SL::Input_Lite::SpecialKeyCodes::ARROWLEFT); |
40 | 10 |
|
| 11 | + std::cout << "Simulating the A key on keyboard is being pressed " << std::endl; |
| 12 | + SL::Input_Lite::SendInput(SL::Input_Lite::KeyEvent{true, SL::Input_Lite::KeyCodes::KEY_A}); |
| 13 | + SL::Input_Lite::SendInput(SL::Input_Lite::KeyEvent{false, SL::Input_Lite::KeyCodes::KEY_A}); |
41 | 14 |
|
42 | | - std::cout << "Starting Mouse move tests by Offset" << std::endl; |
43 | | - SL::Input_Lite::SendMousePosition(SL::Input_Lite::Absolute{ 100, 100 }); |
| 15 | + std::cout << "Starting Mouse move tests by Offset" << std::endl; |
| 16 | + SL::Input_Lite::SendInput(SL::Input_Lite::MousePositionAbsoluteEvent{100, 100}); |
44 | 17 | for (auto x = 0; x < 500; x++) { |
45 | | - SL::Input_Lite::SendMousePosition(SL::Input_Lite::Offset{ 1, 0 }); |
| 18 | + SL::Input_Lite::SendInput(SL::Input_Lite::MousePositionOffsetEvent{1, 0}); |
46 | 19 | std::this_thread::sleep_for(10ms); |
47 | 20 | } |
48 | 21 | for (auto y = 0; y < 500; y++) { |
49 | | - SL::Input_Lite::SendMousePosition(SL::Input_Lite::Offset{ 0, 1 }); |
| 22 | + SL::Input_Lite::SendInput(SL::Input_Lite::MousePositionOffsetEvent{0, 1}); |
50 | 23 | std::this_thread::sleep_for(10ms); |
51 | 24 | } |
52 | 25 | std::cout << "Starting Mouse move tests by Absolute" << std::endl; |
53 | 26 | for (auto x = 0; x < 500; x++) { |
54 | | - SL::Input_Lite::SendMousePosition(SL::Input_Lite::Absolute{ x, 300 }); |
| 27 | + SL::Input_Lite::SendInput(SL::Input_Lite::MousePositionAbsoluteEvent{x, 300}); |
55 | 28 | std::this_thread::sleep_for(10ms); |
56 | 29 | } |
57 | 30 | for (auto y = 0; y < 500; y++) { |
58 | | - SL::Input_Lite::SendMousePosition(SL::Input_Lite::Absolute{ 500, y }); |
| 31 | + SL::Input_Lite::SendInput(SL::Input_Lite::MousePositionAbsoluteEvent{500, y}); |
59 | 32 | std::this_thread::sleep_for(10ms); |
60 | 33 | } |
61 | | - std::cout << "Starting Mouse Click tests " << std::endl; |
62 | | - SL::Input_Lite::SendMouseClick(SL::Input_Lite::MouseButtons::RIGHT); |
63 | | - SL::Input_Lite::SendMouseClick(SL::Input_Lite::MouseButtons::LEFT); |
| 34 | + std::cout << "Starting Mouse Click tests right down up" << std::endl; |
| 35 | + SL::Input_Lite::SendInput(SL::Input_Lite::MouseButtonEvent{true, SL::Input_Lite::MouseButtons::RIGHT}); |
| 36 | + SL::Input_Lite::SendInput(SL::Input_Lite::MouseButtonEvent{false, SL::Input_Lite::MouseButtons::RIGHT}); |
| 37 | + |
| 38 | + std::cout << "Starting Mouse Click tests left down up" << std::endl; |
| 39 | + SL::Input_Lite::SendInput(SL::Input_Lite::MouseButtonEvent{true, SL::Input_Lite::MouseButtons::LEFT}); |
| 40 | + SL::Input_Lite::SendInput(SL::Input_Lite::MouseButtonEvent{false, SL::Input_Lite::MouseButtons::LEFT}); |
| 41 | + |
64 | 42 | std::cout << "Starting Mouse wheel tests " << std::endl; |
65 | 43 | for (auto y = 0; y < 500; y++) { |
66 | | - SL::Input_Lite::SendMouseScroll(1); |
| 44 | + SL::Input_Lite::SendInput(SL::Input_Lite::MouseScrollEvent{1}); |
67 | 45 | std::this_thread::sleep_for(10ms); |
68 | 46 | } |
69 | 47 | for (auto y = 0; y < 500; y++) { |
70 | | - SL::Input_Lite::SendMouseScroll(-1); |
| 48 | + SL::Input_Lite::SendInput(SL::Input_Lite::MouseScrollEvent{-1}); |
71 | 49 | std::this_thread::sleep_for(10ms); |
72 | 50 | } |
73 | 51 |
|
|
0 commit comments