1
/* tinymail - Tiny Mail unit test
2
* Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
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.
14
* You should have received a copy of the GNU General Public License
15
* along with self program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#include "check_libtinymailui.h"
21
#include <tny-platform-factory.h>
25
static TnyPlatformFactory *iface = NULL;
29
tny_platform_factory_test_setup (void)
31
iface = tny_test_platform_factory_get_instance ();
37
tny_platform_factory_test_teardown (void)
40
g_object_unref (G_OBJECT (iface));
45
START_TEST (tny_platform_factory_test_new_device)
47
GObject *obj = (GObject*)tny_platform_factory_new_device (iface);
49
str = g_strdup_printf ("Returned instance doesn't implement TnyDevice\n");
50
fail_unless (TNY_IS_DEVICE (obj), str);
53
g_object_unref (G_OBJECT (obj));
57
START_TEST (tny_platform_factory_test_new_account_store)
59
GObject *obj = (GObject*)tny_platform_factory_new_account_store (iface);
61
str = g_strdup_printf ("Returned instance doesn't implement TnyAccountStore\n");
62
fail_unless (TNY_IS_ACCOUNT_STORE (obj), str);
65
g_object_unref (G_OBJECT (obj));
69
START_TEST(tny_platform_factory_test_new_msg_view)
71
GObject *obj = (GObject*)tny_platform_factory_new_msg_view (iface);
73
str = g_strdup_printf ("Returned instance doesn't implement TnyMsgView\n");
74
fail_unless (TNY_IS_MSG_VIEW (obj), str);
77
/* It's a floating object that gets unreferenced by
78
gtk_widget_destroy() and likes
80
TODO: Make tny-msg-view finalize properly
82
g_object_unref (G_OBJECT (obj)); */
87
create_tny_platform_factory_suite (void)
89
Suite *s = suite_create ("Platform Factory");
92
tc = tcase_create ("New Device");
93
tcase_add_checked_fixture (tc, tny_platform_factory_test_setup, tny_platform_factory_test_teardown);
94
tcase_add_test (tc, tny_platform_factory_test_new_device);
95
suite_add_tcase (s, tc);
97
tc = tcase_create ("New Account Store");
98
tcase_add_checked_fixture (tc, tny_platform_factory_test_setup, tny_platform_factory_test_teardown);
99
tcase_add_test (tc, tny_platform_factory_test_new_account_store);
100
suite_add_tcase (s, tc);
102
tc = tcase_create ("New Message View");
103
tcase_add_checked_fixture (tc, tny_platform_factory_test_setup, tny_platform_factory_test_teardown);
104
tcase_add_test (tc, tny_platform_factory_test_new_msg_view);
105
suite_add_tcase (s, tc);