summaryrefslogtreecommitdiffstats
path: root/plugins/mock/uca-mock-camera.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2018-01-24 10:21:00 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2018-01-24 10:21:00 +0100
commitbc5b68845666e8373527825d813cd79d4c603139 (patch)
treec43353ca50caaaee2f08ad6a466f33d6a91b639c /plugins/mock/uca-mock-camera.c
parentb654527590df0c75db30392ef58eb2d196cf66b1 (diff)
downloaduca-bc5b68845666e8373527825d813cd79d4c603139.tar.gz
uca-bc5b68845666e8373527825d813cd79d4c603139.tar.bz2
uca-bc5b68845666e8373527825d813cd79d4c603139.tar.xz
uca-bc5b68845666e8373527825d813cd79d4c603139.zip
mock: add a custom enum type for test purposes
Diffstat (limited to 'plugins/mock/uca-mock-camera.c')
-rw-r--r--plugins/mock/uca-mock-camera.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/plugins/mock/uca-mock-camera.c b/plugins/mock/uca-mock-camera.c
index 49e1dcd..b829e37 100644
--- a/plugins/mock/uca-mock-camera.c
+++ b/plugins/mock/uca-mock-camera.c
@@ -33,6 +33,7 @@ G_DEFINE_TYPE_WITH_CODE (UcaMockCamera, uca_mock_camera, UCA_TYPE_CAMERA,
enum {
PROP_FILL_DATA = N_BASE_PROPERTIES,
PROP_DEGREE_VALUE,
+ PROP_TEST_ENUM,
N_PROPERTIES
};
@@ -528,12 +529,21 @@ uca_mock_initable_iface_init (GInitableIface *iface)
static void
uca_mock_camera_class_init(UcaMockCameraClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+ GObjectClass *gobject_class;
+ UcaCameraClass *camera_class;
+
+ static GEnumValue enum_values[] = {
+ { 0, "UCA_MOCK_CAMERA_TEST_ENUM_FOO", "foo" },
+ { 1, "UCA_MOCK_CAMERA_TEST_ENUM_BAR", "bar" },
+ { 0, }
+ };
+
+ gobject_class = G_OBJECT_CLASS(klass);
gobject_class->set_property = uca_mock_camera_set_property;
gobject_class->get_property = uca_mock_camera_get_property;
gobject_class->finalize = uca_mock_camera_finalize;
- UcaCameraClass *camera_class = UCA_CAMERA_CLASS(klass);
+ camera_class = UCA_CAMERA_CLASS(klass);
camera_class->start_recording = uca_mock_camera_start_recording;
camera_class->stop_recording = uca_mock_camera_stop_recording;
camera_class->grab = uca_mock_camera_grab;
@@ -557,6 +567,14 @@ uca_mock_camera_class_init(UcaMockCameraClass *klass)
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE);
+ mock_properties[PROP_TEST_ENUM] =
+ g_param_spec_enum ("test-enum",
+ "Test enum",
+ "Test enum",
+ g_enum_register_static ("UcaMockCameraTestEnum", enum_values),
+ 0,
+ G_PARAM_READWRITE);
+
for (guint id = N_BASE_PROPERTIES; id < N_PROPERTIES; id++)
g_object_class_install_property(gobject_class, id, mock_properties[id]);