Mon, 12 Sep 2022 21:30:53 -0500
Make sure the unittests can find our compiled gsettings schemas
Testing Done:
Ran the unit tests and verified the ones failing about schemas were now passing.
Reviewed at https://reviews.imfreedom.org/r/1751/
| 39484 | 1 | /* |
| 2 | * Purple | |
| 3 | * | |
| 4 | * Purple is the legal property of its developers, whose names are too | |
| 5 | * numerous to list here. Please refer to the COPYRIGHT file distributed | |
| 6 | * with this source distribution | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or (at | |
| 11 | * your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, but | |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 16 | * General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
| 21 | */ | |
| 22 | ||
| 23 | #include <glib.h> | |
| 24 | ||
| 25 | #include <purple.h> | |
| 26 | ||
| 27 | /****************************************************************************** | |
| 28 | * Helpers | |
| 29 | *****************************************************************************/ | |
| 30 | static void | |
| 31 | _test_purple_protocol_action_callback(PurpleProtocolAction *action) { | |
| 32 | } | |
| 33 | ||
| 34 | /****************************************************************************** | |
| 35 | * Tests | |
| 36 | *****************************************************************************/ | |
| 37 | static void | |
| 38 | test_purple_protocol_action_new(void) { | |
| 39 | PurpleProtocolAction *action = NULL; | |
| 40 | ||
| 41 | action = purple_protocol_action_new( | |
| 42 | "label", | |
| 43 | _test_purple_protocol_action_callback | |
| 44 | ); | |
| 45 | g_assert_nonnull(action); | |
| 46 | ||
| 47 | g_assert_cmpstr(action->label, ==, "label"); | |
| 48 | g_assert(action->callback == _test_purple_protocol_action_callback); | |
| 49 | ||
| 50 | purple_protocol_action_free(action); | |
| 51 | } | |
| 52 | ||
| 53 | static void | |
| 54 | test_purple_protocol_action_copy(void) { | |
| 55 | PurpleProtocolAction *orig = NULL, *copy = NULL; | |
| 56 | ||
| 57 | orig = purple_protocol_action_new( | |
| 58 | "label", | |
| 59 | _test_purple_protocol_action_callback | |
| 60 | ); | |
| 61 | g_assert_nonnull(orig); | |
| 62 | ||
| 63 | copy = purple_protocol_action_copy(orig); | |
| 64 | purple_protocol_action_free(orig); | |
| 65 | ||
| 66 | g_assert_cmpstr(copy->label, ==, "label"); | |
| 67 | g_assert(copy->callback == _test_purple_protocol_action_callback); | |
| 68 | ||
| 69 | purple_protocol_action_free(copy); | |
| 70 | } | |
| 71 | ||
| 72 | /****************************************************************************** | |
| 73 | * Main | |
| 74 | *****************************************************************************/ | |
| 75 | gint | |
| 76 | main(gint argc, gchar **argv) { | |
| 77 | gint res = 0; | |
| 78 | ||
| 79 | g_test_init(&argc, &argv, NULL); | |
| 80 | ||
| 81 | g_test_set_nonfatal_assertions(); | |
| 82 | ||
| 83 | g_test_add_func( | |
| 84 | "/protocol-action/new", | |
| 85 | test_purple_protocol_action_new | |
| 86 | ); | |
| 87 | ||
| 88 | g_test_add_func( | |
| 89 | "/protocol-action/copy", | |
| 90 | test_purple_protocol_action_copy | |
| 91 | ); | |
| 92 | ||
| 93 | res = g_test_run(); | |
| 94 | ||
| 95 | return res; | |
| 96 | } |