libpurple/tests/test_whiteboard_manager.c

Sat, 01 Oct 2022 01:50:52 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 01 Oct 2022 01:50:52 -0500
changeset 41771
c5877e2c93f2
parent 41040
4be2eda9548a
child 42184
4e1bf25f5575
permissions
-rw-r--r--

Create and add PurpleContacts to the manager when purple_buddy_new is called

This required some additional changes to PurpleContact. Namely that the contact always has a presence and it is no longer writeable.

Testing Done:
Ran the unit tests and verified nothing funky happens when running.

We can't test that all of the properties are properly bound because we would have to start up a lot more of libpurple than I'm willing to do for something that's temporary.

Bugs closed: PIDGIN-17685

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

/*
 * Purple - Internet Messaging Library
 * Copyright (C) Pidgin Developers <devel@pidgin.im>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
 */

#include <glib.h>

#include <purple.h>

#include "test_ui.h"

/******************************************************************************
 * Tests
 *****************************************************************************/
static void
test_purple_whiteboard_manager_get_default(void) {
	PurpleWhiteboardManager *manager1 = NULL, *manager2 = NULL;

	manager1 = purple_whiteboard_manager_get_default();
	g_assert_true(PURPLE_IS_WHITEBOARD_MANAGER(manager1));

	manager2 = purple_whiteboard_manager_get_default();
	g_assert_true(PURPLE_IS_WHITEBOARD_MANAGER(manager2));

	g_assert_true(manager1 == manager2);
}

/******************************************************************************
 * Main
 *****************************************************************************/
gint
main(gint argc, gchar *argv[]) {
	g_test_init(&argc, &argv, NULL);

	test_ui_purple_init();

	g_test_add_func("/whiteboard-manager/get-default",
	                test_purple_whiteboard_manager_get_default);

	return g_test_run();
}

mercurial