~macslow/notify-osd/gsettings-port

« back to all changes in this revision

Viewing changes to tests/test-defaults.c

  • Committer: Mirco Müller
  • Date: 2008-11-26 12:29:04 UTC
  • Revision ID: mirco.mueller@ubuntu.com-20081126122904-gxmj7itk6bj1xz09
added glib-based unit-tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
**3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
 
3
**      10        20        30        40        50        60        70        80
 
4
**
 
5
** project:
 
6
**    alsdorf
 
7
**
 
8
** file:
 
9
**    test-defaults.c
 
10
**
 
11
** author(s):
 
12
**    Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>
 
13
**    David Barth <david.barth@canonical.com>
 
14
**
 
15
** copyright (C) Canonical, oct. 2008
 
16
**
 
17
*******************************************************************************/
 
18
 
 
19
#include <glib.h>
 
20
 
 
21
#include "defaults.h"
 
22
 
 
23
void
 
24
test_defaults_new ()
 
25
{
 
26
        Defaults* defaults = NULL;
 
27
 
 
28
        defaults = defaults_new ();
 
29
        g_assert (defaults != NULL);
 
30
        defaults_del (defaults);
 
31
}
 
32
 
 
33
void
 
34
test_defaults_del ()
 
35
{
 
36
        Defaults* defaults = NULL;
 
37
 
 
38
        defaults = defaults_new ();
 
39
        defaults_del (defaults);
 
40
        /*g_assert (defaults == NULL);*/
 
41
}
 
42
 
 
43
void
 
44
test_defaults_initialized ()
 
45
{
 
46
        Defaults* defaults = NULL;
 
47
 
 
48
        defaults = defaults_new ();
 
49
        g_assert_cmpint (defaults_initialized (defaults), ==, TRUE);
 
50
        defaults_del (defaults);
 
51
}
 
52
 
 
53
void
 
54
test_defaults_get_desktop_width ()
 
55
{
 
56
        Defaults* defaults = NULL;
 
57
 
 
58
        defaults = defaults_new ();
 
59
        g_assert_cmpint (defaults_get_desktop_width (defaults), <=, 4096);
 
60
        g_assert_cmpint (defaults_get_desktop_width (defaults), ==, 800);
 
61
        g_assert_cmpint (defaults_get_desktop_width (defaults), >=, 640);
 
62
        defaults_del (defaults);
 
63
}
 
64
 
 
65
void
 
66
test_defaults_get_desktop_height ()
 
67
{
 
68
        Defaults* defaults = NULL;
 
69
 
 
70
        defaults = defaults_new ();
 
71
        g_assert_cmpint (defaults_get_desktop_height (defaults), <=, 4096);
 
72
        g_assert_cmpint (defaults_get_desktop_height (defaults), ==, 600);
 
73
        g_assert_cmpint (defaults_get_desktop_height (defaults), >=, 600);
 
74
        defaults_del (defaults);
 
75
}
 
76
 
 
77
void
 
78
test_defaults_get_bubble_width ()
 
79
{
 
80
        Defaults* defaults = NULL;
 
81
 
 
82
        defaults = defaults_new ();
 
83
        g_assert_cmpint (defaults_get_bubble_width (defaults), <=, 1024);
 
84
        g_assert_cmpint (defaults_get_bubble_width (defaults), ==, 300);
 
85
        g_assert_cmpint (defaults_get_bubble_width (defaults), >=, 200);
 
86
        defaults_del (defaults);
 
87
}
 
88
 
 
89
void
 
90
test_defaults_get_bubble_height ()
 
91
{
 
92
        Defaults* defaults = NULL;
 
93
 
 
94
        defaults = defaults_new ();
 
95
        g_assert_cmpint (defaults_get_bubble_height (defaults), <=, 300);
 
96
        g_assert_cmpint (defaults_get_bubble_height (defaults), ==, 100);
 
97
        g_assert_cmpint (defaults_get_bubble_height (defaults), >=, 50);
 
98
        defaults_del (defaults);
 
99
}
 
100
 
 
101
void
 
102
test_defaults_get_bubble_opacity ()
 
103
{
 
104
        Defaults* defaults = NULL;
 
105
 
 
106
        defaults = defaults_new ();
 
107
        g_assert_cmpfloat (defaults_get_bubble_opacity (defaults), <=, 1.0f);
 
108
        g_assert_cmpfloat (defaults_get_bubble_opacity (defaults), ==, 0.75f);
 
109
        g_assert_cmpfloat (defaults_get_bubble_opacity (defaults), >=, 0.1f);
 
110
        defaults_del (defaults);
 
111
}
 
112
 
 
113
void
 
114
test_defaults_get_bubble_color ()
 
115
{
 
116
        Defaults* defaults = NULL;
 
117
        gdouble   color[3];
 
118
 
 
119
        defaults = defaults_new ();
 
120
        defaults_get_bubble_color (defaults, &color[0], &color[1], &color[2]);
 
121
        g_assert_cmpfloat (color[0], <=, 1.0f);
 
122
        g_assert_cmpfloat (color[0], ==, 0.1f);
 
123
        g_assert_cmpfloat (color[0], >=, 0.0f);
 
124
        g_assert_cmpfloat (color[1], <=, 1.0f);
 
125
        g_assert_cmpfloat (color[1], ==, 0.1f);
 
126
        g_assert_cmpfloat (color[1], >=, 0.0f);
 
127
        g_assert_cmpfloat (color[2], <=, 1.0f);
 
128
        g_assert_cmpfloat (color[2], ==, 0.1f);
 
129
        g_assert_cmpfloat (color[2], >=, 0.0f);
 
130
        defaults_del (defaults);
 
131
}
 
132
 
 
133
void
 
134
test_defaults_get_font_dpi ()
 
135
{
 
136
        Defaults* defaults = NULL;
 
137
 
 
138
        defaults = defaults_new ();
 
139
        g_assert_cmpfloat (defaults_get_font_dpi (defaults), <=, 300.0f);
 
140
        g_assert_cmpfloat (defaults_get_font_dpi (defaults), ==, 72.0f);
 
141
        g_assert_cmpfloat (defaults_get_font_dpi (defaults), >=, 72.0f);
 
142
        defaults_del (defaults);
 
143
}
 
144
 
 
145
void
 
146
test_defaults_get_font_size ()
 
147
{
 
148
        Defaults* defaults = NULL;
 
149
 
 
150
        defaults = defaults_new ();
 
151
        g_assert_cmpfloat (defaults_get_font_size (defaults), <=, 144.0f);
 
152
        g_assert_cmpfloat (defaults_get_font_size (defaults), ==, 10.0f);
 
153
        g_assert_cmpfloat (defaults_get_font_size (defaults), >=, 5.0f);
 
154
        defaults_del (defaults);
 
155
}
 
156
 
 
157
void
 
158
test_defaults_get_font_face ()
 
159
{
 
160
        Defaults* defaults = NULL;
 
161
        gchar*    face     = NULL;
 
162
 
 
163
        defaults = defaults_new ();
 
164
        face = defaults_get_font_face (defaults);
 
165
        g_assert (face != NULL);
 
166
        g_assert_cmpstr (face, ==, "DejaVu Sans");
 
167
        defaults_del (defaults);
 
168
}
 
169