From 7b9a1ffdeeff03146814f6fdb233481669a41d53 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 4 Apr 2021 21:34:43 +0200 Subject: [PATCH] Made 'rename' blend mode default for buddy scripts --- src/buddies/src/bd/bdReaderOptions.cc | 8 ++++---- src/buddies/unit_tests/bdBasicTests.cc | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/buddies/src/bd/bdReaderOptions.cc b/src/buddies/src/bd/bdReaderOptions.cc index 51981f562..934f8a4ed 100644 --- a/src/buddies/src/bd/bdReaderOptions.cc +++ b/src/buddies/src/bd/bdReaderOptions.cc @@ -39,7 +39,7 @@ GenericReaderOptions::GenericReaderOptions () m_common_enable_text_objects = load_options.get_option_by_name ("text_enabled").to_bool (); m_common_enable_properties = load_options.get_option_by_name ("properties_enabled").to_bool (); - m_cell_conflict_resolution = load_options.get_options ().cell_conflict_resolution; + m_cell_conflict_resolution = (unsigned int) db::CellConflictResolution::RenameCell; m_gds2_box_mode = load_options.get_option_by_name ("gds2_box_mode").to_uint (); m_gds2_allow_big_records = load_options.get_option_by_name ("gds2_allow_big_records").to_bool (); @@ -200,12 +200,12 @@ GenericReaderOptions::add_options (tl::CommandLineOptions &cmd) ) << tl::arg (group + "--" + m_long_prefix + "blend-mode=mode", &m_cell_conflict_resolution, "Specifies how cell conflicts are resolved when using file concatenation", - "When concatenating file with '+', the reader will handle cells with the same names according to this mode:\n" + "When concatenating files with '+', the reader will handle cells with identical names according to this mode:\n" "\n" - "* 0: joins everything (default, risk of spoiling layouts)\n" + "* 0: joins everything (unsafe)\n" "* 1: overwrite\n" "* 2: skip new cell\n" - "* 3: create a variant with a new name" + "* 3: rename cell (safe, default)" ) ; } diff --git a/src/buddies/unit_tests/bdBasicTests.cc b/src/buddies/unit_tests/bdBasicTests.cc index d53ef81b6..5029c0b87 100644 --- a/src/buddies/unit_tests/bdBasicTests.cc +++ b/src/buddies/unit_tests/bdBasicTests.cc @@ -294,3 +294,22 @@ TEST(10) EXPECT_EQ (stream_opt.get_option_by_name ("oasis_expect_strict_mode").to_int (), 1); } + +// Testing reader options - blend mode "Rename" is default +TEST(11) +{ + bd::GenericReaderOptions opt; + tl::CommandLineOptions cmd; + + opt.add_options (cmd); + + const char *argv[] = { "x" }; + + cmd.parse (sizeof (argv) / sizeof (argv[0]), (char **) argv); + + db::LoadLayoutOptions stream_opt; + opt.configure (stream_opt); + + EXPECT_EQ (stream_opt.get_option_by_name ("cell_conflict_resolution").to_string (), "RenameCell"); +} +