From 1b51bc256bc2a4aaeb3fe209709e435b6195af94 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 26 Nov 2013 12:26:30 +0000 Subject: [PATCH] Evas tests: Add canvas free with ref tests. This should check test for the issue fixed in: bb4a19b5ad6a8fc6720154700aabfa32f4b71244 8bba92fbca7c721a7582b098698404e491f44941 --- src/Makefile_Evas.am | 1 + src/tests/evas/evas_suite.c | 1 + src/tests/evas/evas_suite.h | 1 + src/tests/evas/evas_test_object.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 src/tests/evas/evas_test_object.c diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 7a52016..bb80008 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1582,6 +1582,7 @@ TESTS += tests/evas/evas_suite tests_evas_evas_suite_SOURCES = \ tests/evas/evas_suite.c \ tests/evas/evas_test_init.c \ +tests/evas/evas_test_object.c \ tests/evas/evas_test_textblock.c \ tests/evas/evas_test_text.c \ tests/evas/evas_test_callbacks.c \ diff --git a/src/tests/evas/evas_suite.c b/src/tests/evas/evas_suite.c index 057f098..aa9841e 100644 --- a/src/tests/evas/evas_suite.c +++ b/src/tests/evas/evas_suite.c @@ -19,6 +19,7 @@ struct _Evas_Test_Case static const Evas_Test_Case etc[] = { { "Evas", evas_test_init }, + { "Object", evas_test_object }, { "Object Textblock", evas_test_textblock }, { "Object Text", evas_test_text }, { "Callbacks", evas_test_callbacks }, diff --git a/src/tests/evas/evas_suite.h b/src/tests/evas/evas_suite.h index 98b24de..34ba0a6 100644 --- a/src/tests/evas/evas_suite.h +++ b/src/tests/evas/evas_suite.h @@ -4,6 +4,7 @@ #include void evas_test_init(TCase *tc); +void evas_test_object(TCase *tc); void evas_test_textblock(TCase *tc); void evas_test_text(TCase *tc); void evas_test_callbacks(TCase *tc); diff --git a/src/tests/evas/evas_test_object.c b/src/tests/evas/evas_test_object.c new file mode 100644 index 0000000..48770b7 --- /dev/null +++ b/src/tests/evas/evas_test_object.c @@ -0,0 +1,36 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "evas_suite.h" +#include "Evas.h" +#include "evas_tests_helpers.h" + +START_TEST(evas_object_various) +{ + Evas *evas = EVAS_TEST_INIT_EVAS(); + + Evas_Object *obj = evas_object_rectangle_add(evas); + + evas_object_ref(obj); + evas_free(evas); + evas_object_unref(obj); + + evas = EVAS_TEST_INIT_EVAS(); + eo_ref(obj); + evas_free(evas); + eo_unref(obj); + + + /* Twice because EVAS_TEST_INIT_EVAS inits it twice. */ + evas_shutdown(); + evas_shutdown(); +} +END_TEST + +void evas_test_object(TCase *tc) +{ + tcase_add_test(tc, evas_object_various); +} -- 2.7.4