Lines Matching refs:subject
22 static void observer_int(lv_observer_t * observer, lv_subject_t * subject) in observer_int() argument
25 prev_v = lv_subject_get_previous_int(subject); in observer_int()
26 current_v = lv_subject_get_int(subject); in observer_int()
31 static lv_subject_t subject; in test_observer_add_remove() local
32 lv_subject_init_int(&subject, 5); in test_observer_add_remove()
34 lv_observer_t * observer = lv_subject_add_observer(&subject, observer_int, NULL); in test_observer_add_remove()
37 lv_subject_set_int(&subject, 10); in test_observer_add_remove()
38 TEST_ASSERT_EQUAL(10, lv_subject_get_int(&subject)); in test_observer_add_remove()
42 lv_subject_set_int(&subject, 15); in test_observer_add_remove()
43 TEST_ASSERT_EQUAL(15, lv_subject_get_int(&subject)); in test_observer_add_remove()
53 static lv_subject_t subject; in test_observer_int() local
54 lv_subject_init_int(&subject, 5); in test_observer_int()
55 TEST_ASSERT_EQUAL(5, lv_subject_get_int(&subject)); in test_observer_int()
56 TEST_ASSERT_EQUAL(5, lv_subject_get_previous_int(&subject)); in test_observer_int()
58 lv_subject_set_int(&subject, 10); in test_observer_int()
59 TEST_ASSERT_EQUAL(10, lv_subject_get_int(&subject)); in test_observer_int()
60 TEST_ASSERT_EQUAL(5, lv_subject_get_previous_int(&subject)); in test_observer_int()
62 lv_subject_set_int(&subject, 15); in test_observer_int()
63 TEST_ASSERT_EQUAL(15, lv_subject_get_int(&subject)); in test_observer_int()
64 TEST_ASSERT_EQUAL(10, lv_subject_get_previous_int(&subject)); in test_observer_int()
67 lv_subject_set_pointer(&subject, NULL); in test_observer_int()
68 TEST_ASSERT_EQUAL(15, lv_subject_get_int(&subject)); in test_observer_int()
69 TEST_ASSERT_EQUAL(10, lv_subject_get_previous_int(&subject)); in test_observer_int()
71 lv_subject_set_color(&subject, lv_color_black()); in test_observer_int()
72 TEST_ASSERT_EQUAL(15, lv_subject_get_int(&subject)); in test_observer_int()
73 TEST_ASSERT_EQUAL(10, lv_subject_get_previous_int(&subject)); in test_observer_int()
75 lv_subject_copy_string(&subject, "hello"); in test_observer_int()
76 TEST_ASSERT_EQUAL(15, lv_subject_get_int(&subject)); in test_observer_int()
77 TEST_ASSERT_EQUAL(10, lv_subject_get_previous_int(&subject)); in test_observer_int()
84 lv_subject_t subject; in test_observer_string() local
85 lv_subject_init_string(&subject, buf_current, buf_previous, sizeof(buf_current), "hello"); in test_observer_string()
86 TEST_ASSERT_EQUAL_STRING("hello", lv_subject_get_string(&subject)); in test_observer_string()
87 TEST_ASSERT_EQUAL_STRING("hello", lv_subject_get_previous_string(&subject)); in test_observer_string()
89 lv_subject_copy_string(&subject, "my name is John"); in test_observer_string()
90 TEST_ASSERT_EQUAL_STRING("my name is John", lv_subject_get_string(&subject)); in test_observer_string()
91 TEST_ASSERT_EQUAL_STRING("hello", lv_subject_get_previous_string(&subject)); in test_observer_string()
93 lv_subject_copy_string(&subject, "how are you?"); in test_observer_string()
94 TEST_ASSERT_EQUAL_STRING("how are you?", lv_subject_get_string(&subject)); in test_observer_string()
95 TEST_ASSERT_EQUAL_STRING("my name is John", lv_subject_get_previous_string(&subject)); in test_observer_string()
97 lv_subject_snprintf(&subject, "I ate %d pizzas", 10); in test_observer_string()
98 TEST_ASSERT_EQUAL_STRING("I ate 10 pizzas", lv_subject_get_string(&subject)); in test_observer_string()
99 TEST_ASSERT_EQUAL_STRING("how are you?", lv_subject_get_previous_string(&subject)); in test_observer_string()
101 lv_subject_snprintf(&subject, "%d: %s", 1, "Coding is fun !"); in test_observer_string()
102 TEST_ASSERT_EQUAL_STRING("1: Coding is fun !", lv_subject_get_string(&subject)); in test_observer_string()
103 TEST_ASSERT_EQUAL_STRING("I ate 10 pizzas", lv_subject_get_previous_string(&subject)); in test_observer_string()
108 lv_subject_copy_string(&subject, "text to be clipped to 32 chars.this should be clipped"); in test_observer_string()
109 TEST_ASSERT_EQUAL_STRING("text to be clipped to 32 chars.", lv_subject_get_string(&subject)); in test_observer_string()
110 TEST_ASSERT_EQUAL_STRING("1: Coding is fun !", lv_subject_get_previous_string(&subject)); in test_observer_string()
113 lv_subject_copy_string(&subject, "a"); in test_observer_string()
114 TEST_ASSERT_EQUAL_STRING("a", lv_subject_get_string(&subject)); in test_observer_string()
115 …T_ASSERT_EQUAL_STRING("text to be clipped to 32 chars.", lv_subject_get_previous_string(&subject)); in test_observer_string()
118 lv_subject_set_pointer(&subject, NULL); in test_observer_string()
119 TEST_ASSERT_EQUAL_STRING("a", lv_subject_get_string(&subject)); in test_observer_string()
120 …T_ASSERT_EQUAL_STRING("text to be clipped to 32 chars.", lv_subject_get_previous_string(&subject)); in test_observer_string()
122 lv_subject_set_color(&subject, lv_color_black()); in test_observer_string()
123 TEST_ASSERT_EQUAL_STRING("a", lv_subject_get_string(&subject)); in test_observer_string()
124 …T_ASSERT_EQUAL_STRING("text to be clipped to 32 chars.", lv_subject_get_previous_string(&subject)); in test_observer_string()
126 lv_subject_set_int(&subject, 10); in test_observer_string()
127 TEST_ASSERT_EQUAL_STRING("a", lv_subject_get_string(&subject)); in test_observer_string()
128 …T_ASSERT_EQUAL_STRING("text to be clipped to 32 chars.", lv_subject_get_previous_string(&subject)); in test_observer_string()
134 static lv_subject_t subject; in test_observer_pointer() local
136 lv_subject_init_pointer(&subject, &a[0]); in test_observer_pointer()
137 TEST_ASSERT_EQUAL_PTR(&a[0], lv_subject_get_pointer(&subject)); in test_observer_pointer()
138 TEST_ASSERT_EQUAL_PTR(&a[0], lv_subject_get_previous_pointer(&subject)); in test_observer_pointer()
140 lv_subject_set_pointer(&subject, &a[1]); in test_observer_pointer()
141 TEST_ASSERT_EQUAL_PTR(&a[1], lv_subject_get_pointer(&subject)); in test_observer_pointer()
142 TEST_ASSERT_EQUAL_PTR(&a[0], lv_subject_get_previous_pointer(&subject)); in test_observer_pointer()
144 lv_subject_set_pointer(&subject, &a[2]); in test_observer_pointer()
145 TEST_ASSERT_EQUAL_PTR(&a[2], lv_subject_get_pointer(&subject)); in test_observer_pointer()
146 TEST_ASSERT_EQUAL_PTR(&a[1], lv_subject_get_previous_pointer(&subject)); in test_observer_pointer()
149 lv_subject_set_int(&subject, 10); in test_observer_pointer()
150 TEST_ASSERT_EQUAL_PTR(&a[2], lv_subject_get_pointer(&subject)); in test_observer_pointer()
151 TEST_ASSERT_EQUAL_PTR(&a[1], lv_subject_get_previous_pointer(&subject)); in test_observer_pointer()
153 lv_subject_set_color(&subject, lv_color_black()); in test_observer_pointer()
154 TEST_ASSERT_EQUAL_PTR(&a[2], lv_subject_get_pointer(&subject)); in test_observer_pointer()
155 TEST_ASSERT_EQUAL_PTR(&a[1], lv_subject_get_previous_pointer(&subject)); in test_observer_pointer()
157 lv_subject_copy_string(&subject, "hello"); in test_observer_pointer()
158 TEST_ASSERT_EQUAL_PTR(&a[2], lv_subject_get_pointer(&subject)); in test_observer_pointer()
159 TEST_ASSERT_EQUAL_PTR(&a[1], lv_subject_get_previous_pointer(&subject)); in test_observer_pointer()
164 static lv_subject_t subject; in test_observer_color() local
166 lv_subject_init_color(&subject, lv_color_hex3(0x123)); in test_observer_color()
167 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0x123), lv_subject_get_color(&subject)); in test_observer_color()
168 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0x123), lv_subject_get_previous_color(&subject)); in test_observer_color()
170 lv_subject_set_color(&subject, lv_color_hex3(0x456)); in test_observer_color()
171 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0x456), lv_subject_get_color(&subject)); in test_observer_color()
172 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0x123), lv_subject_get_previous_color(&subject)); in test_observer_color()
174 lv_subject_set_color(&subject, lv_color_hex3(0xabc)); in test_observer_color()
175 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0xabc), lv_subject_get_color(&subject)); in test_observer_color()
176 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0x456), lv_subject_get_previous_color(&subject)); in test_observer_color()
179 lv_subject_set_pointer(&subject, NULL); in test_observer_color()
180 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0xabc), lv_subject_get_color(&subject)); in test_observer_color()
181 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0x456), lv_subject_get_previous_color(&subject)); in test_observer_color()
183 lv_subject_set_int(&subject, 10); in test_observer_color()
184 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0xabc), lv_subject_get_color(&subject)); in test_observer_color()
185 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0x456), lv_subject_get_previous_color(&subject)); in test_observer_color()
187 lv_subject_copy_string(&subject, "hello"); in test_observer_color()
188 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0xabc), lv_subject_get_color(&subject)); in test_observer_color()
189 TEST_ASSERT_EQUAL_COLOR(lv_color_hex3(0x456), lv_subject_get_previous_color(&subject)); in test_observer_color()
194 static void group_observer_cb(lv_observer_t * observer, lv_subject_t * subject) in group_observer_cb() argument
197 LV_UNUSED(subject); in group_observer_cb()
238 static lv_subject_t subject; in test_observer_obj_flag() local
239 lv_subject_init_int(&subject, 1); in test_observer_obj_flag()
241 lv_obj_bind_flag_if_eq(obj, &subject, LV_OBJ_FLAG_HIDDEN, 5); in test_observer_obj_flag()
245 lv_obj_bind_flag_if_not_eq(obj, &subject, LV_OBJ_FLAG_CHECKABLE, 10); in test_observer_obj_flag()
250 lv_subject_set_int(&subject, 5); in test_observer_obj_flag()
254 lv_subject_set_int(&subject, 10); in test_observer_obj_flag()
269 static lv_subject_t subject; in test_observer_obj_state() local
270 lv_subject_init_int(&subject, 1); in test_observer_obj_state()
272 lv_obj_bind_state_if_eq(obj, &subject, LV_STATE_CHECKED, 5); in test_observer_obj_state()
276 lv_obj_bind_state_if_not_eq(obj, &subject, LV_STATE_DISABLED, 10); in test_observer_obj_state()
281 lv_subject_set_int(&subject, 5); in test_observer_obj_state()
285 lv_subject_set_int(&subject, 10); in test_observer_obj_state()
303 static lv_subject_t subject; in test_observer_button_checked() local
304 lv_subject_init_int(&subject, 1); in test_observer_button_checked()
305 lv_obj_bind_checked(obj, &subject); in test_observer_button_checked()
309 lv_subject_set_int(&subject, 0); in test_observer_button_checked()
314 TEST_ASSERT_EQUAL(1, lv_subject_get_int(&subject)); in test_observer_button_checked()
425 static lv_subject_t subject; in test_observer_arc_value() local
426 lv_subject_init_int(&subject, 30); in test_observer_arc_value()
427 lv_arc_bind_value(obj, &subject); in test_observer_arc_value()
431 lv_subject_set_int(&subject, 40); in test_observer_arc_value()
444 TEST_ASSERT_EQUAL(50, lv_subject_get_int(&subject)); in test_observer_arc_value()
451 static lv_subject_t subject; in test_observer_slider_value() local
452 lv_subject_init_int(&subject, 30); in test_observer_slider_value()
453 lv_slider_bind_value(obj, &subject); in test_observer_slider_value()
457 lv_subject_set_int(&subject, 40); in test_observer_slider_value()
474 TEST_ASSERT_EQUAL(29, lv_subject_get_int(&subject)); in test_observer_slider_value()
481 static lv_subject_t subject; in test_observer_roller_value() local
482 lv_subject_init_int(&subject, 1); in test_observer_roller_value()
483 lv_roller_bind_value(obj, &subject); in test_observer_roller_value()
487 lv_subject_set_int(&subject, 2); in test_observer_roller_value()
494 TEST_ASSERT_EQUAL(1, lv_subject_get_int(&subject)); in test_observer_roller_value()
501 static lv_subject_t subject; in test_observer_dropdown_value() local
502 lv_subject_init_int(&subject, 1); in test_observer_dropdown_value()
503 lv_dropdown_bind_value(obj, &subject); in test_observer_dropdown_value()
507 lv_subject_set_int(&subject, 2); in test_observer_dropdown_value()
515 TEST_ASSERT_EQUAL(0, lv_subject_get_int(&subject)); in test_observer_dropdown_value()
520 static lv_subject_t subject; in test_observer_deinit() local
528 lv_subject_init_int(&subject, 30); in test_observer_deinit()
529 lv_slider_bind_value(obj1, &subject); in test_observer_deinit()
530 lv_slider_bind_value(obj2, &subject); in test_observer_deinit()
531 lv_subject_add_observer(&subject, observer_int, NULL); in test_observer_deinit()
533 lv_subject_deinit(&subject); in test_observer_deinit()