diff --git a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc index 6e54e9bfdf..57847406ae 100644 --- a/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc +++ b/src/plugins/streamers/oasis/db_plugin/dbOASISWriter.cc @@ -1338,30 +1338,34 @@ OASISWriter::write_cellname_table (size_t &cellnames_table_pos, const std::vecto write ((unsigned long) *cell); } - if (m_options.write_std_properties > 1) { + if (m_options.write_std_properties >= 1) { reset_modal_variables (); - // write S_BOUNDING_BOX entries + if (m_options.write_std_properties > 1) { - std::vector values; + // write S_BOUNDING_BOX entries - // TODO: how to set the "depends on external cells" flag? - db::Box bbox = layout.cell (*cell).bbox (); - if (bbox.empty ()) { - // empty box - values.push_back (tl::Variant ((unsigned int) 0x2)); - bbox = db::Box (0, 0, 0, 0); - } else { - values.push_back (tl::Variant ((unsigned int) 0x0)); - } + std::vector values; - values.push_back (tl::Variant (bbox.left ())); - values.push_back (tl::Variant (bbox.bottom ())); - values.push_back (tl::Variant (bbox.width ())); - values.push_back (tl::Variant (bbox.height ())); + // TODO: how to set the "depends on external cells" flag? + db::Box bbox = layout.cell (*cell).bbox (); + if (bbox.empty ()) { + // empty box + values.push_back (tl::Variant ((unsigned int) 0x2)); + bbox = db::Box (0, 0, 0, 0); + } else { + values.push_back (tl::Variant ((unsigned int) 0x0)); + } + + values.push_back (tl::Variant (bbox.left ())); + values.push_back (tl::Variant (bbox.bottom ())); + values.push_back (tl::Variant (bbox.width ())); + values.push_back (tl::Variant (bbox.height ())); - write_property_def (s_bounding_box_name, values, true); + write_property_def (s_bounding_box_name, values, true); + + } // PROPERTY record with S_CELL_OFFSET if (cell_positions) { diff --git a/src/plugins/streamers/oasis/unit_tests/dbOASISWriterTests.cc b/src/plugins/streamers/oasis/unit_tests/dbOASISWriterTests.cc index ac574affb0..a78292db22 100644 --- a/src/plugins/streamers/oasis/unit_tests/dbOASISWriterTests.cc +++ b/src/plugins/streamers/oasis/unit_tests/dbOASISWriterTests.cc @@ -1532,6 +1532,65 @@ TEST(116) EXPECT_EQ (std::string (os.string ()), std::string (expected)) } + { + std::string tmp_file = tl::TestBase::tmp_file ("tmp_dbOASISWriter116d2.gds"); + + { + tl::OutputStream out (tmp_file); + db::SaveLayoutOptions write_options; + write_options.set_format ("OASIS"); + db::OASISWriterOptions oas_write_options; + oas_write_options.write_std_properties = 1; + oas_write_options.strict_mode = true; + oas_write_options.write_cblocks = false; + write_options.set_options (oas_write_options); + db::Writer writer (write_options); + writer.write (g, out); + } + + tl::InputStream in (tmp_file); + db::OASISReaderOptions oas_options; + oas_options.read_all_properties = true; + oas_options.expect_strict_mode = 1; + db::LoadLayoutOptions options; + options.set_options (oas_options); + db::Reader reader (in); + db::Layout gg; + reader.set_warnings_as_errors (true); + reader.read (gg, options); + + const char *expected = + "set props {\n" + " {{S_MAX_SIGNED_INTEGER_WIDTH} {4}}\n" + " {{S_MAX_UNSIGNED_INTEGER_WIDTH} {4}}\n" + " {{S_TOP_CELL} {$2}}\n" + " {{S_TOP_CELL} {$1}}\n" + " {{name} {117}}\n" + " {17 {17value}}\n" + "}\n" + "begin_libp $props 0.001\n" + "set props {\n" + " {42 {42}}\n" + " {{S_CELL_OFFSET} {182}}\n" + "}\n" + "begin_cellp $props {$1}\n" + "path 1 0 0 0 0 {0 100} {1000 1200}\n" + "end_cell\n" + "set props {\n" + " {{S_CELL_OFFSET} {180}}\n" + "}\n" + "begin_cellp $props {$2}\n" + "end_cell\n" + "end_lib\n" + ; + + tl::OutputStringStream os; + tl::OutputStream stream (os); + db::TextWriter textwriter (stream); + textwriter.write (gg); + EXPECT_EQ (std::string (os.string ()), std::string (expected)) + } + c1.insert (db::CellInstArray (c2.cell_index (), db::Trans ())); {