From 4962b6b83156da58725901d1d58515528add746b Mon Sep 17 00:00:00 2001 From: Abdelhakim Qbaich Date: Sat, 4 Apr 2026 16:39:50 -0400 Subject: [PATCH] Add test for large property string failure --- .../oasis/unit_tests/dbOASISReaderTests.cc | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc b/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc index e44086c74..a577ca093 100644 --- a/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc +++ b/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc @@ -23,6 +23,7 @@ #include "dbOASISReader.h" #include "dbOASISWriter.h" +#include "dbLayoutDiff.h" #include "dbTextWriter.h" #include "dbTestSupport.h" #include "tlLog.h" @@ -696,3 +697,41 @@ TEST(BlendCrash) std::string fn_au (tl::testdata () + "/oasis/blend_crash_au.gds.gz"); db::compare_layouts (_this, layout, fn_au, db::WriteGDS2, 1); } + +TEST(CBlockLargePropertyString) +{ + db::Manager m (false); + db::Layout layout_org (&m); + + unsigned int layer = layout_org.insert_layer (db::LayerProperties (1, 0)); + db::Cell &top = layout_org.cell (layout_org.add_cell ("TOP")); + + std::string large_value (42000, 'a'); + + db::PropertiesSet ps; + ps.insert (db::property_names_id (tl::Variant ("blob")), tl::Variant (large_value)); + + top.shapes (layer).insert (db::BoxWithProperties (db::Box (0, 0, 100, 100), db::properties_id (ps))); + + std::string tmp_file = tl::TestBase::tmp_file ("tmp_OASISReaderLargeString.oas"); + + { + tl::OutputStream out (tmp_file); + db::SaveLayoutOptions options; + db::OASISWriterOptions &oasis_options = options.get_options (); + oasis_options.write_cblocks = true; + oasis_options.strict_mode = false; + db::OASISWriter writer; + writer.write (layout_org, out, options); + } + + db::Layout layout_read; + + { + tl::InputStream in (tmp_file); + db::OASISReader reader (in); + reader.read (layout_read); + } + + EXPECT_EQ (db::compare_layouts (layout_org, layout_read, db::layout_diff::f_verbose, 0), true); +}