Skip to content

Commit f47e795

Browse files
Update test_keyboard.cpp
1 parent a87f884 commit f47e795

File tree

1 file changed

+63
-6
lines changed

1 file changed

+63
-6
lines changed

code/tests/cases/test_keyboard.cpp

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,16 @@ FOSSIL_TEST_CASE(cpp_test_keyboard_poll_events) {
7575

7676
FOSSIL_TEST_CASE(cpp_test_mouse_register_and_unregister) {
7777
fossil::io::Mouse mouse;
78-
fossil_io_mouse_event_t event = { 1, 100, 200, 0 };
78+
79+
fossil_io_mouse_event_t event = {
80+
.x = 100,
81+
.y = 200,
82+
.button = 1,
83+
.shift = 1,
84+
.ctrl = 0,
85+
.alt = 1
86+
};
87+
7988
fossil_io_mouse_callback_t callback = (fossil_io_mouse_callback_t)0x2;
8089

8190
mouse.register_binding(event, callback);
@@ -87,7 +96,16 @@ FOSSIL_TEST_CASE(cpp_test_mouse_register_and_unregister) {
8796

8897
FOSSIL_TEST_CASE(cpp_test_mouse_clear_bindings) {
8998
fossil::io::Mouse mouse;
90-
fossil_io_mouse_event_t event = { 2, 150, 250, 0 };
99+
100+
fossil_io_mouse_event_t event = {
101+
.x = 150,
102+
.y = 250,
103+
.button = 2,
104+
.shift = 0,
105+
.ctrl = 1,
106+
.alt = 0
107+
};
108+
91109
fossil_io_mouse_callback_t callback = (fossil_io_mouse_callback_t)0x2;
92110

93111
mouse.register_binding(event, callback);
@@ -97,7 +115,16 @@ FOSSIL_TEST_CASE(cpp_test_mouse_clear_bindings) {
97115

98116
FOSSIL_TEST_CASE(cpp_test_mouse_poll_events) {
99117
fossil::io::Mouse mouse;
100-
fossil_io_mouse_event_t event = { 3, 120, 180, 0 };
118+
119+
fossil_io_mouse_event_t event = {
120+
.x = 120,
121+
.y = 180,
122+
.button = 0,
123+
.shift = 0,
124+
.ctrl = 0,
125+
.alt = 0
126+
};
127+
101128
fossil_io_mouse_callback_t callback = (fossil_io_mouse_callback_t)0x2;
102129

103130
mouse.register_binding(event, callback);
@@ -111,7 +138,17 @@ FOSSIL_TEST_CASE(cpp_test_mouse_poll_events) {
111138

112139
FOSSIL_TEST_CASE(cpp_test_touch_register_and_unregister) {
113140
fossil::io::Touch touch;
114-
fossil_io_touch_event_t event = { 0, 400, 300, 0 };
141+
142+
fossil_io_touch_event_t event = {
143+
.x = 400,
144+
.y = 300,
145+
.touch_id = 1,
146+
.action = 0,
147+
.shift = 0,
148+
.ctrl = 1,
149+
.alt = 0
150+
};
151+
115152
fossil_io_touch_callback_t callback = (fossil_io_touch_callback_t)0x3;
116153

117154
touch.register_binding(event, callback);
@@ -123,7 +160,17 @@ FOSSIL_TEST_CASE(cpp_test_touch_register_and_unregister) {
123160

124161
FOSSIL_TEST_CASE(cpp_test_touch_clear_bindings) {
125162
fossil::io::Touch touch;
126-
fossil_io_touch_event_t event = { 1, 500, 600, 0 };
163+
164+
fossil_io_touch_event_t event = {
165+
.x = 500,
166+
.y = 600,
167+
.touch_id = 2,
168+
.action = 1,
169+
.shift = 1,
170+
.ctrl = 0,
171+
.alt = 1
172+
};
173+
127174
fossil_io_touch_callback_t callback = (fossil_io_touch_callback_t)0x3;
128175

129176
touch.register_binding(event, callback);
@@ -133,7 +180,17 @@ FOSSIL_TEST_CASE(cpp_test_touch_clear_bindings) {
133180

134181
FOSSIL_TEST_CASE(cpp_test_touch_poll_events) {
135182
fossil::io::Touch touch;
136-
fossil_io_touch_event_t event = { 2, 700, 800, 0 };
183+
184+
fossil_io_touch_event_t event = {
185+
.x = 700,
186+
.y = 800,
187+
.touch_id = 3,
188+
.action = 2,
189+
.shift = 1,
190+
.ctrl = 1,
191+
.alt = 0
192+
};
193+
137194
fossil_io_touch_callback_t callback = (fossil_io_touch_callback_t)0x3;
138195

139196
touch.register_binding(event, callback);

0 commit comments

Comments
 (0)