aboutsummaryrefslogtreecommitdiff
path: root/tests/test-libcustomindicator.c
blob: ecc187b5cc480ebf2efba37a0ad3305e2458ab05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

#include <glib.h>
#include <glib-object.h>

#include <libcustomindicator/custom-indicator.h>

void
test_libcustomindicator_init_set_props (void)
{
	CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL));
	g_assert(ci != NULL);

	custom_indicator_set_id(ci, "my-id");
	custom_indicator_set_category(ci, CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS);
	custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ON);
	custom_indicator_set_icon(ci, "my-name");
	custom_indicator_set_attention_icon(ci, "my-attention-name");

	g_assert(!g_strcmp0("my-id", custom_indicator_get_id(ci)));
	g_assert(!g_strcmp0("my-name", custom_indicator_get_icon(ci)));
	g_assert(!g_strcmp0("my-attention-name", custom_indicator_get_attention_icon(ci)));
	g_assert(custom_indicator_get_status(ci) == CUSTOM_INDICATOR_STATUS_ON);
	g_assert(custom_indicator_get_category(ci) == CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS);

	g_object_unref(G_OBJECT(ci));
	return;
}

void
test_libcustomindicator_init_with_props (void)
{
	CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, 
	                                                     "id", "my-id",
	                                                     "category", CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS,
	                                                     "status", CUSTOM_INDICATOR_STATUS_ON,
	                                                     "icon-name", "my-name",
	                                                     "attention-icon-name", "my-attention-name",
	                                                     NULL));
	g_assert(ci != NULL);

	g_assert(!g_strcmp0("my-id", custom_indicator_get_id(ci)));
	g_assert(!g_strcmp0("my-name", custom_indicator_get_icon(ci)));
	g_assert(!g_strcmp0("my-attention-name", custom_indicator_get_attention_icon(ci)));
	g_assert(custom_indicator_get_status(ci) == CUSTOM_INDICATOR_STATUS_ON);
	g_assert(custom_indicator_get_category(ci) == CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS);

	g_object_unref(G_OBJECT(ci));
	return;
}

void
test_libcustomindicator_init (void)
{
	CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL));
	g_assert(ci != NULL);
	g_object_unref(G_OBJECT(ci));
	return;
}

void
test_libcustomindicator_props_suite (void)
{
	g_test_add_func ("/indicator-custom/libcustomindicator/init",        test_libcustomindicator_init);
	g_test_add_func ("/indicator-custom/libcustomindicator/init_props",  test_libcustomindicator_init_with_props);
	g_test_add_func ("/indicator-custom/libcustomindicator/init_set_props",  test_libcustomindicator_init_set_props);


	return;
}

gint
main (gint argc, gchar * argv[])
{
	g_type_init();
	g_test_init(&argc, &argv, NULL);

	/* Test suites */
	test_libcustomindicator_props_suite();


	return g_test_run ();
}