[aravis] gc_float: fix get_inc to return a double value.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] gc_float: fix get_inc to return a double value.
- Date: Tue, 6 Mar 2012 16:42:19 +0000 (UTC)
commit 8ccbac490a6db73ac0e9990a00f089ca0b7cb400
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Tue Mar 6 17:40:50 2012 +0100
gc_float: fix get_inc to return a double value.
The documentation is wrong compared to the reference implementation.
src/arvgcfloat.c | 2 +-
src/arvgcfloat.h | 4 ++--
src/arvgcfloatnode.c | 4 ++--
tests/data/genicam.xml | 18 ++++++++++++++++++
tests/genicam.c | 18 ++++++++++++++++++
5 files changed, 41 insertions(+), 5 deletions(-)
---
diff --git a/src/arvgcfloat.c b/src/arvgcfloat.c
index be0028c..d98cfb8 100644
--- a/src/arvgcfloat.c
+++ b/src/arvgcfloat.c
@@ -81,7 +81,7 @@ arv_gc_float_get_max (ArvGcFloat *gc_float)
return G_MAXDOUBLE;
}
-gint64
+double
arv_gc_float_get_inc (ArvGcFloat *gc_float)
{
ArvGcFloatInterface *float_interface;
diff --git a/src/arvgcfloat.h b/src/arvgcfloat.h
index 1ebfbed..d9556f1 100644
--- a/src/arvgcfloat.h
+++ b/src/arvgcfloat.h
@@ -41,7 +41,7 @@ struct _ArvGcFloatInterface {
void (*set_value) (ArvGcFloat *gc_float, double value);
double (*get_min) (ArvGcFloat *gc_float);
double (*get_max) (ArvGcFloat *gc_float);
- gint64 (*get_inc) (ArvGcFloat *gc_float);
+ double (*get_inc) (ArvGcFloat *gc_float);
const char * (*get_unit) (ArvGcFloat *gc_float);
void (*impose_min) (ArvGcFloat *gc_float, double minimum);
void (*impose_max) (ArvGcFloat *gc_float, double maximum);
@@ -53,7 +53,7 @@ double arv_gc_float_get_value (ArvGcFloat *gc_float);
void arv_gc_float_set_value (ArvGcFloat *gc_float, double value);
double arv_gc_float_get_min (ArvGcFloat *gc_float);
double arv_gc_float_get_max (ArvGcFloat *gc_float);
-gint64 arv_gc_float_get_inc (ArvGcFloat *gc_float);
+double arv_gc_float_get_inc (ArvGcFloat *gc_float);
const char * arv_gc_float_get_unit (ArvGcFloat *gc_float);
void arv_gc_float_impose_min (ArvGcFloat *gc_float, double minimum);
void arv_gc_float_impose_max (ArvGcFloat *gc_float, double maximum);
diff --git a/src/arvgcfloatnode.c b/src/arvgcfloatnode.c
index 19c3919..e0525bb 100644
--- a/src/arvgcfloatnode.c
+++ b/src/arvgcfloatnode.c
@@ -194,13 +194,13 @@ arv_gc_float_node_get_max (ArvGcFloat *gc_float)
return G_MAXFLOAT;
}
-static gint64
+static double
arv_gc_float_node_get_inc (ArvGcFloat *gc_float)
{
ArvGcFloatNode *gc_float_node = ARV_GC_FLOAT_NODE (gc_float);
if (gc_float_node->increment != NULL)
- return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_float_node->increment));
+ return arv_gc_property_node_get_double (ARV_GC_PROPERTY_NODE (gc_float_node->increment));
return 1;
}
diff --git a/tests/data/genicam.xml b/tests/data/genicam.xml
index 5001a84..e3db315 100644
--- a/tests/data/genicam.xml
+++ b/tests/data/genicam.xml
@@ -24,10 +24,28 @@
<Float Name="RWFloat">
<Value>0.1</Value>
+ <Min>-10.0</Min>
+ <Max>10.0</Max>
+ <Inc>2.0</Inc>
+ </Float>
+
+ <Float Name="P_RWFloat_Min">
+ <Value>-20.0</Value>
+ </Float>
+
+ <Float Name="P_RWFloat_Max">
+ <Value>20.0</Value>
+ </Float>
+
+ <Float Name="P_RWFloat_Inc">
+ <Value>3.0</Value>
</Float>
<Float Name="P_RWFloat">
<pValue>RWFloat</pValue>
+ <pMin>P_RWFloat_Min</pMin>
+ <pMax>P_RWFloat_Max</pMax>
+ <pInc>P_RWFloat_Inc</pInc>
</Float>
<Boolean Name="RWBoolean">
diff --git a/tests/genicam.c b/tests/genicam.c
index c6f10cf..975ea08 100644
--- a/tests/genicam.c
+++ b/tests/genicam.c
@@ -108,6 +108,15 @@ float_test (void)
v_double = arv_gc_float_get_value (ARV_GC_FLOAT (node));
g_assert_cmpfloat (v_double, ==, 0.1);
+ v_double = arv_gc_float_get_min (ARV_GC_FLOAT (node));
+ g_assert_cmpfloat (v_double, ==, -10.0);
+
+ v_double = arv_gc_float_get_max (ARV_GC_FLOAT (node));
+ g_assert_cmpfloat (v_double, ==, 10.0);
+
+ v_double = arv_gc_float_get_inc (ARV_GC_FLOAT (node));
+ g_assert_cmpfloat (v_double, ==, 2.0);
+
v_string = arv_gc_feature_node_get_value_as_string (ARV_GC_FEATURE_NODE (node));
g_assert_cmpstr (v_string, ==, "0.1");
@@ -121,6 +130,15 @@ float_test (void)
v_double = arv_gc_float_get_value (ARV_GC_FLOAT (node));
g_assert_cmpfloat (v_double, ==, 0.2);
+ v_double = arv_gc_float_get_min (ARV_GC_FLOAT (node));
+ g_assert_cmpfloat (v_double, ==, -20.0);
+
+ v_double = arv_gc_float_get_max (ARV_GC_FLOAT (node));
+ g_assert_cmpfloat (v_double, ==, 20.0);
+
+ v_double = arv_gc_float_get_inc (ARV_GC_FLOAT (node));
+ g_assert_cmpfloat (v_double, ==, 3.0);
+
g_object_unref (device);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]