From f59c4874a69dfc3777196f4291802b6ab839a35c Mon Sep 17 00:00:00 2001 From: Timo Dritschler Date: Fri, 18 Jul 2014 16:58:24 +0200 Subject: Added new get_camerah (Get Camera Hash) interface to Pugin Manager Added unit-test to test/test-mock for the new get_camerah interface --- test/test-mock.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'test/test-mock.c') diff --git a/test/test-mock.c b/test/test-mock.c index 8edcf8f..5573666 100644 --- a/test/test-mock.c +++ b/test/test-mock.c @@ -291,6 +291,41 @@ test_can_be_written (Fixture *fixture, gconstpointer data) g_assert_no_error (error); } +static void +test_factory_hashtable (Fixture *fixture, gconstpointer data) +{ + GError *error = NULL; + + guint checkvalue = 42; + + gchar *foo = "roi-width"; + gchar *bar = "roi-height"; + GValue baz = G_VALUE_INIT; + g_value_init(&baz, G_TYPE_UINT); + g_value_set_uint(&baz, checkvalue); + + GHashTable *ght = g_hash_table_new (NULL, NULL); + g_hash_table_insert(ght, foo, &baz); + g_hash_table_insert(ght, bar, &baz); + + UcaCamera *camera = uca_plugin_manager_get_camerah (fixture->manager, + "mock", ght, &error); + g_hash_table_destroy(ght); + + g_assert (error == NULL); + g_assert (camera); + + guint roi_width = 0; + g_object_get (G_OBJECT (camera), "roi-width", &roi_width, NULL); + g_assert (roi_width == checkvalue); + + guint roi_height = 0; + g_object_get (G_OBJECT (camera), "roi-height", &roi_height, NULL); + g_assert (roi_height == checkvalue); + + g_object_unref(camera); +} + int main (int argc, char *argv[]) { gsize n_tests; @@ -308,6 +343,7 @@ int main (int argc, char *argv[]) } tests[] = { {"/factory", test_factory}, + {"/factory/hashtable", test_factory_hashtable}, {"/signal", test_signal}, {"/recording", test_recording}, {"/recording/signal", test_recording_signal}, -- cgit v1.2.3