~ubuntu-branches/ubuntu/trusty/indicator-session/trusty-updates

« back to all changes in this revision

Viewing changes to tests/test-service.cc

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Charles Kerr, Ubuntu daily release
  • Date: 2013-08-23 22:07:25 UTC
  • mfrom: (1.1.69)
  • Revision ID: package-import@ubuntu.com-20130823220725-fzr93wqbe35hs2bc
Tags: 12.10.5+13.10.20130823-0ubuntu1
[ Charles Kerr ]
* use an a{sv}, rather than the obsoleted (sssb), for the root
  action's state.

[ Ubuntu daily release ]
* Automatic snapshot from revision 410

Show diffs side-by-side

added added

removed removed

Lines of Context:
318
318
 
319
319
    void check_header (const char * expected_label, const char * expected_icon, const char * expected_a11y)
320
320
    {
321
 
       GVariant * variant;
322
 
       const gchar * label = NULL;
323
 
       const gchar * icon = NULL;
324
 
       const gchar * a11y = NULL;
325
 
       gboolean visible;
326
 
 
327
 
      variant = g_action_group_get_action_state (G_ACTION_GROUP(action_group), "_header");
328
 
      g_variant_get (variant, "(&s&s&sb)", &label, &icon, &a11y, &visible);
 
321
      GVariant * state = g_action_group_get_action_state (G_ACTION_GROUP(action_group), "_header");
 
322
      ASSERT_TRUE (state != NULL);
 
323
      ASSERT_TRUE (g_variant_is_of_type (state, G_VARIANT_TYPE ("a{sv}")));
329
324
 
330
325
      if (expected_label != NULL)
331
 
        ASSERT_STREQ (expected_label, label);
 
326
        {
 
327
          GVariant * v = g_variant_lookup_value (state, "label", G_VARIANT_TYPE_STRING);
 
328
          if (!v) // if no label in the state, expected_label must be an empty string
 
329
            ASSERT_FALSE (*expected_label);
 
330
          else
 
331
            ASSERT_STREQ (expected_label, g_variant_get_string (v, NULL));
 
332
        }
 
333
 
 
334
      if (expected_a11y != NULL)
 
335
        {
 
336
          GVariant * v = g_variant_lookup_value (state, "accessible-desc", G_VARIANT_TYPE_STRING);
 
337
          ASSERT_TRUE (v != NULL);
 
338
          ASSERT_STREQ (expected_a11y, g_variant_get_string (v, NULL));
 
339
          g_variant_unref (v);
 
340
        }
332
341
 
333
342
      if (expected_icon != NULL)
334
 
        ASSERT_STREQ (expected_icon, icon);
335
 
 
336
 
      if (expected_a11y != NULL)
337
 
        ASSERT_STREQ (expected_a11y, a11y);
 
343
        {
 
344
          GVariant * v = g_variant_lookup_value (state, "icon", NULL);
 
345
          GIcon * expected = g_themed_icon_new (expected_icon);
 
346
          GIcon * actual = g_icon_deserialize (v);
 
347
          ASSERT_TRUE (g_icon_equal (expected, actual));
 
348
          g_object_unref (actual);
 
349
          g_object_unref (expected);
 
350
          g_variant_unref (v);
 
351
        }
338
352
 
339
353
      // the session menu is always visible...
 
354
      gboolean visible = false;
 
355
      g_variant_lookup (state, "visible", "b", &visible);
340
356
      ASSERT_TRUE (visible);
341
357
 
342
 
      g_variant_unref (variant);
 
358
      g_variant_unref (state);
343
359
    }
344
360
 
345
361
    void check_label (const char * expected_label, GMenuModel * model, int pos)