diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2018-01-24 10:21:00 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2018-01-24 10:21:00 +0100 |
commit | bc5b68845666e8373527825d813cd79d4c603139 (patch) | |
tree | c43353ca50caaaee2f08ad6a466f33d6a91b639c /plugins | |
parent | b654527590df0c75db30392ef58eb2d196cf66b1 (diff) | |
download | uca-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')
-rw-r--r-- | plugins/mock/uca-mock-camera.c | 22 |
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]); |