libpurple/tests/test_purplepath.c

Mon, 22 Aug 2022 22:05:55 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 22 Aug 2022 22:05:55 -0500
changeset 41514
a96768bacb59
parent 41243
53b46590623f
child 41735
c9b476c9c9d2
permissions
-rw-r--r--

Create PurpleAuthorizationRequest and use it for notifications.

This replaces the old internal representation of authorization requests as well
as the UI's implementation of their own objects. Everything is now controlled
via PurpleAuthorizationRequest and the UI's display the notification for
interaction.

Testing Done:
Verified the notification and actions work in both finch and pidgin.

Reviewed at https://reviews.imfreedom.org/r/1613/

41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
1 #include <glib.h>
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
2
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
3 #include <purple.h>
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
4
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
5 static void
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
6 test_purplepath_home_dir(void) {
41243
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
7 const gchar *home_dir;
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
8
41243
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
9 #ifndef _WIN32
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
10 home_dir = g_get_home_dir();
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
11 #else
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
12 home_dir = g_getenv("APPDATA");
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
13 #endif
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
14 g_assert_cmpstr(home_dir, ==, purple_home_dir());
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
15 }
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
16
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
17 static void
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
18 test_purplepath_cache_dir(void) {
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
19 gchar *cache_dir;
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
20
41243
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
21 cache_dir = g_build_filename(g_get_user_cache_dir(), "purple", NULL);
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
22 g_assert_cmpstr(cache_dir, ==, purple_cache_dir());
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
23 g_free(cache_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
24 }
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
25
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
26 static void
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
27 test_purplepath_config_dir(void) {
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
28 gchar *config_dir;
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
29
41243
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
30 config_dir = g_build_filename(g_get_user_config_dir(), "purple", NULL);
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
31 g_assert_cmpstr(config_dir, ==, purple_config_dir());
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
32 g_free(config_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
33 }
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
34
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
35 static void
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
36 test_purplepath_data_dir(void) {
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
37 gchar *data_dir;
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
38
41243
53b46590623f test_purplepath: replace g_get_home_dir with g_get_user_*_dir functions
ivanhoe <ivanhoe@fiscari.de>
parents: 41242
diff changeset
39 data_dir = g_build_filename(g_get_user_data_dir(), "purple", NULL);
41242
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
40 g_assert_cmpstr(data_dir, ==, purple_data_dir());
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
41 g_free(data_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
42 }
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
43
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
44 gint
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
45 main(gint argc, gchar **argv) {
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
46 g_test_init(&argc, &argv, NULL);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
47
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
48 g_test_add_func("/purplepath/homedir",
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
49 test_purplepath_home_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
50 g_test_add_func("/purplepath/cachedir",
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
51 test_purplepath_cache_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
52 g_test_add_func("/purplepath/configdir",
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
53 test_purplepath_config_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
54 g_test_add_func("/purplepath/datadir",
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
55 test_purplepath_data_dir);
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
56 return g_test_run();
0343173db2f6 added basic tests for path based functions
ivanhoe <107501-ivanhoe@users.noreply.gitlab.com>
parents:
diff changeset
57 }

mercurial