From 1a3cc870d63e565d20d1b870b58549b73d24624a Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Mon, 4 Mar 2013 15:22:19 +0100 Subject: [PATCH] adg: ensure local-mix in AdgTitleBlock behaves like in AdgTable AdgTitleBlock is a special AdgTable, so they should mix local matrices in the same way. The provided test case is not that needed because AdgTitleBlock inherits from AdgTable but previously g_object_new() was setting the local-mix default, so it has been included to avoid regression in such case. --- src/adg/adg-title-block.c | 7 ++----- src/adg/tests/test-title-block.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/adg/adg-title-block.c b/src/adg/adg-title-block.c index 2bbcf8eb..f5734265 100644 --- a/src/adg/adg-title-block.c +++ b/src/adg/adg-title-block.c @@ -332,9 +332,7 @@ _adg_set_property(GObject *object, guint prop_id, /** * adg_title_block_new: * - * Creates a new empty title block entity. The #AdgEntity:local-mix - * property is set by default to #ADG_MIX_DISABLED, that is the - * title block is not subject to any local transformations. + * Creates a new empty title block entity. * * Returns: (transfer full): the newly created title block entity. * @@ -343,8 +341,7 @@ _adg_set_property(GObject *object, guint prop_id, AdgTitleBlock * adg_title_block_new(void) { - return g_object_new(ADG_TYPE_TITLE_BLOCK, - "local-mix", ADG_MIX_DISABLED, NULL); + return g_object_new(ADG_TYPE_TITLE_BLOCK, NULL); } /** diff --git a/src/adg/tests/test-title-block.c b/src/adg/tests/test-title-block.c index 6b07c891..9bbe8000 100644 --- a/src/adg/tests/test-title-block.c +++ b/src/adg/tests/test-title-block.c @@ -22,6 +22,32 @@ static void +_adg_test_local_mix(void) +{ + AdgTitleBlock *title_block; + AdgEntity *entity; + + /* Ensure the title block behaves exaclty like an AdgTable */ + + title_block = adg_title_block_new(); + entity = (AdgEntity *) title_block; + g_assert_cmpint(adg_entity_get_local_mix(entity), ==, ADG_MIX_DISABLED); + adg_entity_destroy(entity); + + /* Check local mix method overriding */ + title_block = g_object_new(ADG_TYPE_TITLE_BLOCK, "local-mix", ADG_MIX_ANCESTORS_NORMALIZED, NULL); + entity = (AdgEntity *) title_block; + g_assert_cmpint(adg_entity_get_local_mix(entity), ==, ADG_MIX_ANCESTORS_NORMALIZED); + adg_entity_destroy(entity); + + /* Check default mix using GObject methods */ + title_block = g_object_new(ADG_TYPE_TITLE_BLOCK, NULL); + entity = (AdgEntity *) title_block; + g_assert_cmpint(adg_entity_get_local_mix(entity), ==, ADG_MIX_DISABLED); + adg_entity_destroy(entity); +} + +static void _adg_test_author(void) { AdgTitleBlock *title_block; @@ -387,6 +413,7 @@ main(int argc, char *argv[]) { adg_test_init(&argc, &argv); + adg_test_add_func("/adg/title-block/local-mix", _adg_test_local_mix); adg_test_add_func("/adg/title-block/author", _adg_test_author); adg_test_add_func("/adg/title-block/date", _adg_test_date); adg_test_add_func("/adg/title-block/drawing", _adg_test_drawing); -- 2.11.4.GIT