aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Terry <michael.terry@canonical.com>2013-01-10 17:18:55 -0500
committerMichael Terry <michael.terry@canonical.com>2013-01-10 17:18:55 -0500
commit616555a9509f3b1f313ea3056e30c48737eeb908 (patch)
tree891421654f31b5da8198a3cb2fa2da28e443b24c /tests
parent59a0f715f324fb45001364a5876a6fd0b51a107a (diff)
downloadlibayatana-appindicator-616555a9509f3b1f313ea3056e30c48737eeb908.tar.gz
libayatana-appindicator-616555a9509f3b1f313ea3056e30c48737eeb908.tar.bz2
libayatana-appindicator-616555a9509f3b1f313ea3056e30c48737eeb908.zip
some packaging fixes to make tests more resistant to timing issues and warnings from sub-libraries
Diffstat (limited to 'tests')
-rw-r--r--tests/test-libappindicator-fallback-item.c2
-rw-r--r--tests/test-libappindicator-fallback-watcher.c3
-rw-r--r--tests/test-libappindicator.c28
3 files changed, 31 insertions, 2 deletions
diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c
index 418b779..c87ef8c 100644
--- a/tests/test-libappindicator-fallback-item.c
+++ b/tests/test-libappindicator-fallback-item.c
@@ -138,7 +138,7 @@ main (int argc, char ** argv)
GtkWidget * menu = gtk_menu_new();
app_indicator_set_menu(APP_INDICATOR(item), GTK_MENU(menu));
- g_timeout_add_seconds(2, kill_func, NULL);
+ g_timeout_add_seconds(20, kill_func, NULL);
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);
diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c
index 5494082..f337150 100644
--- a/tests/test-libappindicator-fallback-watcher.c
+++ b/tests/test-libappindicator-fallback-watcher.c
@@ -77,6 +77,7 @@ main (int argv, char ** argc)
while (!has_owner && owner_count < 10000) {
org_freedesktop_DBus_name_has_owner(bus_proxy, "org.test", &has_owner, NULL);
owner_count++;
+ g_usleep(500000);
}
if (owner_count == 10000) {
@@ -104,7 +105,7 @@ main (int argv, char ** argc)
/* This is the final kill function. It really shouldn't happen
unless we get an error. */
- g_timeout_add(2000, kill_func, NULL);
+ g_timeout_add_seconds(20, kill_func, NULL);
g_debug("Entering Mainloop");
diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c
index 7afd3ba..0c69fde 100644
--- a/tests/test-libappindicator.c
+++ b/tests/test-libappindicator.c
@@ -28,6 +28,16 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+static gboolean
+allow_warnings (const gchar *log_domain, GLogLevelFlags log_level,
+ const gchar *message, gpointer user_data)
+{
+ // By default, gtest will fail a test on even a warning message.
+ // But since some of our sub-libraries are noisy (especially at-spi2),
+ // only fail on critical or worse.
+ return ((log_level & G_LOG_LEVEL_MASK) <= G_LOG_LEVEL_CRITICAL);
+}
+
void
test_libappindicator_prop_signals_status_helper (AppIndicator * ci, gchar * status, gboolean * signalactivated)
{
@@ -45,6 +55,8 @@ test_libappindicator_prop_signals_helper (AppIndicator * ci, gboolean * signalac
void
test_libappindicator_prop_signals (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
AppIndicator * ci = app_indicator_new ("test-app-indicator",
"indicator-messages",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
@@ -115,6 +127,8 @@ test_libappindicator_prop_signals (void)
void
test_libappindicator_init_set_props (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
AppIndicator * ci = app_indicator_new ("my-id",
"my-name",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
@@ -139,6 +153,8 @@ test_libappindicator_init_set_props (void)
void
test_libappindicator_init_with_props (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
AppIndicator * ci = app_indicator_new ("my-id",
"my-name",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
@@ -161,6 +177,8 @@ test_libappindicator_init_with_props (void)
void
test_libappindicator_init (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
AppIndicator * ci = app_indicator_new ("my-id", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
g_assert(ci != NULL);
g_object_unref(G_OBJECT(ci));
@@ -170,6 +188,8 @@ test_libappindicator_init (void)
void
test_libappindicator_set_label (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
AppIndicator * ci = app_indicator_new ("my-id",
"my-name",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
@@ -232,6 +252,8 @@ test_libappindicator_set_label (void)
void
test_libappindicator_set_menu (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
AppIndicator * ci = app_indicator_new ("my-id",
"my-name",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
@@ -301,6 +323,8 @@ label_signals_check (void)
void
test_libappindicator_label_signals (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
gint label_signals_count = 0;
AppIndicator * ci = app_indicator_new ("my-id",
"my-name",
@@ -352,6 +376,8 @@ test_libappindicator_label_signals (void)
void
test_libappindicator_desktop_menu (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
AppIndicator * ci = app_indicator_new ("my-id-desktop-menu",
"my-name",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
@@ -388,6 +414,8 @@ test_libappindicator_desktop_menu (void)
void
test_libappindicator_desktop_menu_bad (void)
{
+ g_test_log_set_fatal_handler (allow_warnings, NULL);
+
AppIndicator * ci = app_indicator_new ("my-id-desktop-menu-bad",
"my-name",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);