diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-03-05 17:20:27 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-03-05 17:20:27 +0100 |
commit | 03739354e074c547d99a6992a7774c3643d17da1 (patch) | |
tree | 37091acf1b6101493f9243fbd5b5201be951fdce /test | |
parent | 0483c86add2f496021560b82476d22e2497006be (diff) | |
download | libuca-03739354e074c547d99a6992a7774c3643d17da1.tar.gz libuca-03739354e074c547d99a6992a7774c3643d17da1.tar.bz2 libuca-03739354e074c547d99a6992a7774c3643d17da1.tar.xz libuca-03739354e074c547d99a6992a7774c3643d17da1.zip |
Add factory method to create new cameras
Diffstat (limited to 'test')
-rw-r--r-- | test/test-gobject.c | 16 | ||||
-rw-r--r-- | test/test-mock.c | 9 |
2 files changed, 13 insertions, 12 deletions
diff --git a/test/test-gobject.c b/test/test-gobject.c index 3ff77bf..e8b14a8 100644 --- a/test/test-gobject.c +++ b/test/test-gobject.c @@ -6,19 +6,11 @@ int main(int argc, char **argv) { g_type_init(); - GError *error = NULL; - UcaMockCamera *cam = uca_mock_camera_new(&error); + gchar **types = uca_camera_get_types(); - if (cam == NULL) { - g_error("Camera could not be initialized\n"); + for (guint i = 0; i < g_strv_length(types); i++) { + g_print("Camera: %s\n", types[i]); } - guint width, height; - g_object_get(cam, - "sensor-width", &width, - "sensor-height", &height, - NULL); - g_print("resolution %ix%i\n", width, height); - - g_object_unref(cam); + g_strfreev(types); } diff --git a/test/test-mock.c b/test/test-mock.c index 5340166..a9284cf 100644 --- a/test/test-mock.c +++ b/test/test-mock.c @@ -26,6 +26,14 @@ static void on_property_change(gpointer instance, GParamSpec *pspec, gpointer us *success = TRUE; } +static void test_factory() +{ + GError *error = NULL; + UcaCamera *camera = uca_camera_new("fox994m3a0yxmy", &error); + g_assert_error(error, UCA_CAMERA_ERROR, UCA_CAMERA_ERROR_NOT_FOUND); + g_assert(camera == NULL); +} + static void test_recording(Fixture *fixture, gconstpointer data) { GError *error = NULL; @@ -150,6 +158,7 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); g_test_bug_base("http://ufo.kit.edu/ufo/ticket"); + g_test_add_func("/factory", test_factory); g_test_add("/recording", Fixture, NULL, fixture_setup, test_recording, fixture_teardown); g_test_add("/recording/signal", Fixture, NULL, fixture_setup, test_recording_signal, fixture_teardown); g_test_add("/recording/asynchronous", Fixture, NULL, fixture_setup, test_recording_async, fixture_teardown); |