1 /*
2 * Copyright © 2010 Canonical Ltd.
3 * By Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19 #include <glib.h>
20 #include <glib-object.h>
21 #include "zeitgeist.h"
22
23 typedef struct
24 {
25 } Fixture;
26
27 static void setup (Fixture *fix, gconstpointer data);
28 static void teardown (Fixture *fix, gconstpointer data);
29
30 static void
setup(Fixture * fix,gconstpointer data)31 setup (Fixture *fix, gconstpointer data)
32 {
33 }
34
35 static void
teardown(Fixture * fix,gconstpointer data)36 teardown (Fixture *fix, gconstpointer data)
37 {
38 }
39
40 static void
test_create(Fixture * fix,gconstpointer data)41 test_create (Fixture *fix, gconstpointer data)
42 {
43 ZeitgeistMonitor *mon;
44 ZeitgeistTimeRange *tr;
45 GPtrArray *event_templates, *event_templates_;
46
47 event_templates = g_ptr_array_new ();
48 mon = zeitgeist_monitor_new (zeitgeist_time_range_new (27, 68),
49 event_templates);
50
51 g_object_get (mon,
52 "time-range", &tr,
53 "event-templates", &event_templates_,
54 NULL);
55
56 g_assert_cmpint (27, ==, zeitgeist_time_range_get_start (tr));
57 g_assert_cmpint (68, ==, zeitgeist_time_range_get_end (tr));
58
59 g_assert (event_templates == event_templates_);
60
61 g_object_unref (tr);
62 g_ptr_array_unref (event_templates_);
63 g_object_unref (mon);
64 }
65
66 int
main(int argc,char * argv[])67 main (int argc,
68 char *argv[])
69 {
70 g_type_init();
71 g_test_init (&argc, &argv, NULL);
72
73 g_test_add ("/Zeitgeist/Monitor/Create", Fixture, NULL,
74 setup, test_create, teardown);
75
76 return g_test_run();
77 }
78