~jbicha/hud/build-depend-on-valac-not-gir

« back to all changes in this revision

Viewing changes to tests/test-hud-client-param.c

  • Committer: Tarmac
  • Author(s): Ted Gould, Pete Woods, Antti Kaijanmäki, Ted Gould, Albert Astals, Ryan Lortie, Łukasz 'sil2100' Zemczak, Albert Astals Cid, Mathieu Trudel-Lapierre, Kaleo, Tarmac, Ricardo Salveti de Araujo, Michael Terry, Automatic PS uploader
  • Date: 2013-04-10 16:04:51 UTC
  • mfrom: (227.3.148 phablet)
  • Revision ID: tarmac-20130410160451-o3owpv3zaxulm5of
HUD 2.0 Merge.

Approved by PS Jenkins bot, Mathieu Trudel-Lapierre.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include <libdbustest/dbus-test.h>
 
3
#include <hud-client.h>
 
4
#include "shared-values.h"
 
5
 
 
6
#include "hudtestutils.h"
 
7
 
 
8
static void
 
9
test_param_create (void)
 
10
{
 
11
 
 
12
  DbusTestService *service = dbus_test_service_new (NULL );
 
13
    hud_test_utils_dbus_mock_start (service, DBUS_NAME, DBUS_PATH, DBUS_IFACE);
 
14
  GDBusConnection *connection = hud_test_utils_mock_dbus_connection_new (
 
15
      service, DBUS_NAME, NULL );
 
16
  hud_test_utils_process_mainloop (300);
 
17
 
 
18
  HudClientParam* param = hud_client_param_new ("app.dbus.name", "base_action", "/action/path",
 
19
      "/model/path", 1);
 
20
 
 
21
  g_object_unref(param);
 
22
  g_object_unref(service);
 
23
 
 
24
  hud_test_utils_wait_for_connection_close(connection);
 
25
}
 
26
 
 
27
static void
 
28
test_param_get_actions (void)
 
29
{
 
30
 
 
31
  DbusTestService *service = dbus_test_service_new (NULL );
 
32
    hud_test_utils_dbus_mock_start (service, DBUS_NAME, DBUS_PATH, DBUS_IFACE);
 
33
  hud_test_utils_json_loader_start_full (service, "app.dbus.name", "/menu",
 
34
      JSON_SOURCE_ONE);
 
35
  GDBusConnection *connection = hud_test_utils_mock_dbus_connection_new (
 
36
      service, DBUS_NAME, "app.dbus.name", NULL );
 
37
    hud_test_utils_process_mainloop (300);
 
38
 
 
39
  HudClientParam* param = hud_client_param_new ("app.dbus.name", "base_action", "/action/path",
 
40
      "/model/path", 1);
 
41
 
 
42
  GActionGroup *action_group = hud_client_param_get_actions(param);
 
43
  g_assert(action_group);
 
44
 
 
45
  g_object_unref(param);
 
46
  g_object_unref(service);
 
47
 
 
48
  hud_test_utils_wait_for_connection_close(connection);
 
49
}
 
50
 
 
51
static void
 
52
test_suite (void)
 
53
{
 
54
  g_test_add_func ("/hud/client/param/create", test_param_create);
 
55
  g_test_add_func ("/hud/client/param/get_actions", test_param_get_actions);
 
56
}
 
57
 
 
58
int
 
59
main (int argc, char * argv[])
 
60
{
 
61
#ifndef GLIB_VERSION_2_36
 
62
        g_type_init ();
 
63
#endif
 
64
 
 
65
        g_test_init(&argc, &argv, NULL);
 
66
 
 
67
        /* Test Suites */
 
68
        test_suite();
 
69
 
 
70
        return g_test_run();
 
71
}