summaryrefslogtreecommitdiff
path: root/lib/packagekit-glib2/pk-desktop.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2009-12-03 09:10:47 +0000
committerRichard Hughes <richard@hughsie.com>2009-12-03 09:10:47 +0000
commit8768fa13c9a4f846cdf61a06e8e6507e563a79ad (patch)
treedaccfdf6138afa63c4ba243e30af4937277f6763 /lib/packagekit-glib2/pk-desktop.c
parenta03725a61030664782c37d7830b6c9733132e694 (diff)
trivial: fix make check from exploding by unreferencing the array properly in the test suite
Diffstat (limited to 'lib/packagekit-glib2/pk-desktop.c')
-rw-r--r--lib/packagekit-glib2/pk-desktop.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/packagekit-glib2/pk-desktop.c b/lib/packagekit-glib2/pk-desktop.c
index e9d973671..fe72039c7 100644
--- a/lib/packagekit-glib2/pk-desktop.c
+++ b/lib/packagekit-glib2/pk-desktop.c
@@ -372,7 +372,6 @@ pk_desktop_test (gpointer user_data)
egg_test_success (test, "created db with dummy, skipping remaining tests");
goto out;
}
-
if (g_strcmp0 (package, "gnome-packagekit") == 0)
egg_test_success (test, NULL);
else
@@ -382,22 +381,24 @@ pk_desktop_test (gpointer user_data)
/************************************************************/
egg_test_title (test, "get files");
array = pk_desktop_get_files_for_package (desktop, "gnome-packagekit", NULL);
- if (array->len >= 5)
+ if (array == NULL)
+ egg_test_failed (test, "array NULL");
+ else if (array->len >= 5)
egg_test_success (test, NULL);
else
egg_test_failed (test, "length=%i", array->len);
- g_ptr_array_foreach (array, (GFunc) g_free, NULL);
- g_ptr_array_free (array, TRUE);
+ g_ptr_array_unref (array);
/************************************************************/
egg_test_title (test, "get shown files");
- array = pk_desktop_get_shown_for_package (desktop, "f-spot", NULL);
- if (array->len == 1)
+ array = pk_desktop_get_shown_for_package (desktop, "gnome-packagekit", NULL);
+ if (array == NULL)
+ egg_test_failed (test, "array NULL");
+ else if (array->len == 5)
egg_test_success (test, NULL);
else
egg_test_failed (test, "length=%i", array->len);
- g_ptr_array_foreach (array, (GFunc) g_free, NULL);
- g_ptr_array_free (array, TRUE);
+ g_ptr_array_unref (array);
out:
g_object_unref (desktop);