summaryrefslogtreecommitdiffstats
path: root/test/test-mock.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2014-09-15 17:51:25 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2014-09-15 17:51:25 +0200
commit98bce3088c6a5ee7a0fd35f104ec62b61d3aca13 (patch)
tree2db1398b85ebcf33b34ff103078545abc1bcfb85 /test/test-mock.c
parent761414259c36d447fb3aaabe2239cfd09b33b05f (diff)
downloaduca-98bce3088c6a5ee7a0fd35f104ec62b61d3aca13.tar.gz
uca-98bce3088c6a5ee7a0fd35f104ec62b61d3aca13.tar.bz2
uca-98bce3088c6a5ee7a0fd35f104ec62b61d3aca13.tar.xz
uca-98bce3088c6a5ee7a0fd35f104ec62b61d3aca13.zip
Add test for buffered recording
Diffstat (limited to 'test/test-mock.c')
-rw-r--r--test/test-mock.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/test-mock.c b/test/test-mock.c
index c0acc9c..8edcf8f 100644
--- a/test/test-mock.c
+++ b/test/test-mock.c
@@ -147,6 +147,44 @@ test_recording_property (Fixture *fixture, gconstpointer data)
}
static void
+test_recording_buffered (Fixture *fixture, gconstpointer data)
+{
+ UcaCamera *camera = UCA_CAMERA (fixture->camera);
+ GError *error = NULL;
+ guint width, height, bitdepth;
+ gsize buffer_size;
+ gchar *buffer;
+
+ g_object_get (G_OBJECT (camera),
+ "roi-width", &width,
+ "roi-height", &height,
+ "sensor-bitdepth", &bitdepth,
+ NULL);
+
+ buffer_size = width * height * (bitdepth <= 8 ? 1 : 2);
+ buffer = g_malloc0 (buffer_size);
+
+ g_object_set (G_OBJECT (camera),
+ "buffered", TRUE,
+ "num-buffers", 5,
+ NULL);
+
+ uca_camera_start_recording (camera, &error);
+ g_assert_no_error (error);
+
+ for (int i = 0; i < 10; i++) {
+ g_assert (uca_camera_grab (camera, (gpointer) buffer, &error));
+ g_assert_no_error (error);
+ }
+
+ uca_camera_stop_recording (camera, &error);
+ g_assert_no_error (error);
+
+ g_free (buffer);
+}
+
+
+static void
test_base_properties (Fixture *fixture, gconstpointer data)
{
UcaCamera *camera = UCA_CAMERA (fixture->camera);
@@ -274,6 +312,7 @@ int main (int argc, char *argv[])
{"/recording", test_recording},
{"/recording/signal", test_recording_signal},
{"/recording/asynchronous", test_recording_async},
+ {"/recording/buffered", test_recording_buffered},
{"/properties/base", test_base_properties},
{"/properties/recording", test_recording_property},
{"/properties/binnings", test_binnings_properties},