[at-spi2-core: 9/10] atk_test_state_set_new(): Test the set of states without iteration




commit f3751ab6e2b04d2cd77cde19dfcd1d3f153f4ebf
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Jul 4 19:16:35 2022 -0500

    atk_test_state_set_new(): Test the set of states without iteration
    
    We only have two states, after all...

 tests/at-spi2-atk/atk_test_state_set.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/tests/at-spi2-atk/atk_test_state_set.c b/tests/at-spi2-atk/atk_test_state_set.c
index c1de2d1b..8d0c0216 100644
--- a/tests/at-spi2-atk/atk_test_state_set.c
+++ b/tests/at-spi2-atk/atk_test_state_set.c
@@ -57,27 +57,17 @@ atk_test_state_set_new (gpointer fixture, gconstpointer user_data)
 {
   GArray *states_arr = g_array_new (FALSE, FALSE, sizeof (AtspiStateType));
 
-  gint state = 0;
-  state = 11; // ATSPI_STATE_FOCUSABLE
+  AtspiStateType state = ATSPI_STATE_FOCUSABLE;
   g_array_append_val (states_arr, state);
-  state = 12; // ATSPI_STATE_FOCUSED
+  state = ATSPI_STATE_FOCUSED;
   g_array_append_val (states_arr, state);
 
   g_assert_cmpint (states_arr->len, ==, 2);
 
   AtspiStateSet *ss = atspi_state_set_new (states_arr);
 
-  AtspiStateType valid_states[] = {
-    ATSPI_STATE_FOCUSABLE,
-    ATSPI_STATE_FOCUSED,
-  };
-
-  g_assert (atspi_state_set_contains (ss, valid_states[0]));
-  g_assert (atspi_state_set_contains (ss, valid_states[1]));
-  int i = 0;
-  for (i = 0; i < states_arr->len; ++i) {
-    g_assert_cmpint (valid_states[i], ==, g_array_index (states_arr, AtspiStateType, i));
-  }
+  g_assert (atspi_state_set_contains (ss, ATSPI_STATE_FOCUSABLE));
+  g_assert (atspi_state_set_contains (ss, ATSPI_STATE_FOCUSED));
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]