[clutter] conform/interval: Add transformation unit test
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] conform/interval: Add transformation unit test
- Date: Mon, 18 Jun 2012 17:07:31 +0000 (UTC)
commit c57cabd4c26d8d99559cf65593599a1737438952
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Mon Jun 18 18:04:10 2012 +0100
conform/interval: Add transformation unit test
Verify that it's possible to pass a transformable type to
ClutterInterval.
tests/conform/interval.c | 31 +++++++++++++++++++++++++++++++
tests/conform/test-conform-main.c | 1 +
2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/tests/conform/interval.c b/tests/conform/interval.c
index 9bc63be..2ee3ea8 100644
--- a/tests/conform/interval.c
+++ b/tests/conform/interval.c
@@ -37,3 +37,34 @@ interval_initial_state (TestConformSimpleFixture *fixture G_GNUC_UNUSED,
g_object_unref (interval);
}
+
+void
+interval_transform (TestConformSimpleFixture *fixture G_GNUC_UNUSED,
+ gconstpointer dummy G_GNUC_UNUSED)
+{
+ ClutterInterval *interval;
+ GValue value = G_VALUE_INIT;
+ const GValue *value_p = NULL;
+
+ interval = clutter_interval_new_with_values (G_TYPE_FLOAT, NULL, NULL);
+
+ g_value_init (&value, G_TYPE_DOUBLE);
+
+ g_value_set_double (&value, 0.0);
+ clutter_interval_set_initial_value (interval, &value);
+
+ g_value_set_double (&value, 100.0);
+ clutter_interval_set_final_value (interval, &value);
+
+ g_value_unset (&value);
+
+ value_p = clutter_interval_peek_initial_value (interval);
+ g_assert (G_VALUE_HOLDS_FLOAT (value_p));
+ g_assert_cmpfloat (g_value_get_float (value_p), ==, 0.f);
+
+ value_p = clutter_interval_peek_final_value (interval);
+ g_assert (G_VALUE_HOLDS_FLOAT (value_p));
+ g_assert_cmpfloat (g_value_get_float (value_p), ==, 100.f);
+
+ g_object_unref (interval);
+}
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 0e5b457..14a2e66 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -189,6 +189,7 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/texture/cairo", texture_cairo);
TEST_CONFORM_SIMPLE ("/interval", interval_initial_state);
+ TEST_CONFORM_SIMPLE ("/interval", interval_transform);
TEST_CONFORM_SIMPLE ("/path", path_base);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]