This commit is contained in:
Matthias Koefferlein 2024-12-24 15:39:27 +01:00
parent acdb18039b
commit 28260a68b0
14 changed files with 532 additions and 455 deletions

View File

@ -424,7 +424,17 @@ public:
tl::Event prop_ids_changed_event;
private:
struct CompareNamePtrByValue
struct CompareNamePtrByValueForValues
{
bool operator() (const tl::Variant *a, const tl::Variant *b) const
{
// NOTE: for values, the type should matter, so 2.0 is different from 2 (integer).
// Hence we use "less" here.
return a->less (*b);
}
};
struct CompareNamePtrByValueForNames
{
bool operator() (const tl::Variant *a, const tl::Variant *b) const
{
@ -440,9 +450,9 @@ private:
}
};
std::set <const tl::Variant *, CompareNamePtrByValue> m_propnames;
std::set <const tl::Variant *, CompareNamePtrByValueForNames> m_propnames;
std::list <tl::Variant> m_property_names_heap;
std::set <const tl::Variant *, CompareNamePtrByValue> m_propvalues;
std::set <const tl::Variant *, CompareNamePtrByValueForValues> m_propvalues;
std::list <tl::Variant> m_property_values_heap;
std::set <const PropertiesSet *, ComparePropertiesPtrByValue> m_properties;
std::list <PropertiesSet> m_properties_heap;

View File

@ -187,7 +187,7 @@ TEST(PropertySetsMerge)
ps1.merge (ps2);
EXPECT_EQ (ps1.to_dict_var ().to_string (), "17=>value,x=>42");
EXPECT_EQ (ps1.to_dict_var ().to_string (), "{17=>value,x=>42}");
}
TEST(PropertySetsConversions)
@ -198,8 +198,8 @@ TEST(PropertySetsConversions)
ps1.insert (tl::Variant (17), tl::Variant ("value"));
ps1.insert (tl::Variant ("x"), tl::Variant (42));
EXPECT_EQ (ps1.to_dict_var ().to_string (), "17=>value,x=>42");
EXPECT_EQ (ps1.to_list_var ().to_string (), "17,value,x,42");
EXPECT_EQ (ps1.to_dict_var ().to_string (), "{17=>value,x=>42}");
EXPECT_EQ (ps1.to_list_var ().to_string (), "((17,value),(x,42))");
auto ps1_map = ps1.to_map ();
EXPECT_EQ (ps1_map.size (), size_t (2));
@ -229,107 +229,107 @@ TEST(PropertiesTranslator)
ps.insert (key1, 100);
ps.insert (key2, 101);
db::properties_id_type prop1a = rp.properties_id (ps);
EXPECT_EQ (db::prop2string (prop1a), "1=>100,2=>101");
EXPECT_EQ (db::prop2string (prop1a), "{1=>100,2=>101}");
ps.clear ();
ps.insert (key1, 0);
ps.insert (key2, 101);
db::properties_id_type prop1b = rp.properties_id (ps);
EXPECT_EQ (db::prop2string (prop1b), "1=>0,2=>101");
EXPECT_EQ (db::prop2string (prop1b), "{1=>0,2=>101}");
ps.clear ();
ps.insert (key1, 100);
ps.insert (key3, 102);
db::properties_id_type prop2 = rp.properties_id (ps);
EXPECT_EQ (db::prop2string (prop2), "1=>100,3=>102");
EXPECT_EQ (db::prop2string (prop2), "{1=>100,3=>102}");
ps.clear ();
ps.insert (key1, 100);
db::properties_id_type prop3 = rp.properties_id (ps);
EXPECT_EQ (db::prop2string (prop3), "1=>100");
EXPECT_EQ (db::prop2string (prop3), "{1=>100}");
db::PropertiesTranslator t;
EXPECT_EQ (db::prop2string (t (prop1a)), "1=>100,2=>101");
EXPECT_EQ (db::prop2string (t (prop1b)), "1=>0,2=>101");
EXPECT_EQ (db::prop2string (t (prop2)), "1=>100,3=>102");
EXPECT_EQ (db::prop2string (t (prop3)), "1=>100");
EXPECT_EQ (db::prop2string (t (prop1a)), "{1=>100,2=>101}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{1=>0,2=>101}");
EXPECT_EQ (db::prop2string (t (prop2)), "{1=>100,3=>102}");
EXPECT_EQ (db::prop2string (t (prop3)), "{1=>100}");
t = db::PropertiesTranslator::make_pass_all ();
EXPECT_EQ (db::prop2string (t (prop1a)), "1=>100,2=>101");
EXPECT_EQ (db::prop2string (t (prop1b)), "1=>0,2=>101");
EXPECT_EQ (db::prop2string (t (prop2)), "1=>100,3=>102");
EXPECT_EQ (db::prop2string (t (prop3)), "1=>100");
EXPECT_EQ (db::prop2string (t (prop1a)), "{1=>100,2=>101}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{1=>0,2=>101}");
EXPECT_EQ (db::prop2string (t (prop2)), "{1=>100,3=>102}");
EXPECT_EQ (db::prop2string (t (prop3)), "{1=>100}");
t = db::PropertiesTranslator::make_remove_all ();
EXPECT_EQ (db::prop2string (t (prop1a)), "");
EXPECT_EQ (db::prop2string (t (prop1b)), "");
EXPECT_EQ (db::prop2string (t (prop2)), "");
EXPECT_EQ (db::prop2string (t (prop3)), "");
EXPECT_EQ (db::prop2string (t (prop1a)), "{}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{}");
EXPECT_EQ (db::prop2string (t (prop2)), "{}");
EXPECT_EQ (db::prop2string (t (prop3)), "{}");
std::set<tl::Variant> kf;
kf.insert (1);
t = db::PropertiesTranslator::make_filter (kf, rp);
EXPECT_EQ (db::prop2string (t (prop1a)), "1=>100");
EXPECT_EQ (db::prop2string (t (prop1b)), "1=>0");
EXPECT_EQ (db::prop2string (t (prop2)), "1=>100");
EXPECT_EQ (db::prop2string (t (prop3)), "1=>100");
EXPECT_EQ (db::prop2string (t (prop1a)), "{1=>100}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{1=>0}");
EXPECT_EQ (db::prop2string (t (prop2)), "{1=>100}");
EXPECT_EQ (db::prop2string (t (prop3)), "{1=>100}");
kf.insert (3);
t = db::PropertiesTranslator::make_filter (kf, rp);
EXPECT_EQ (db::prop2string (t (prop1a)), "1=>100");
EXPECT_EQ (db::prop2string (t (prop1b)), "1=>0");
EXPECT_EQ (db::prop2string (t (prop2)), "1=>100,3=>102");
EXPECT_EQ (db::prop2string (t (prop3)), "1=>100");
EXPECT_EQ (db::prop2string (t (prop1a)), "{1=>100}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{1=>0}");
EXPECT_EQ (db::prop2string (t (prop2)), "{1=>100,3=>102}");
EXPECT_EQ (db::prop2string (t (prop3)), "{1=>100}");
std::map<tl::Variant, tl::Variant> km;
km[1] = 4;
km[3] = 1;
t = db::PropertiesTranslator::make_key_mapper (km, rp);
EXPECT_EQ (db::prop2string (t (prop1a)), "4=>100");
EXPECT_EQ (db::prop2string (t (prop1b)), "4=>0");
EXPECT_EQ (db::prop2string (t (prop2)), "1=>102,4=>100");
EXPECT_EQ (db::prop2string (t (prop3)), "4=>100");
EXPECT_EQ (db::prop2string (t (prop1a)), "{4=>100}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{4=>0}");
EXPECT_EQ (db::prop2string (t (prop2)), "{1=>102,4=>100}");
EXPECT_EQ (db::prop2string (t (prop3)), "{4=>100}");
kf.clear ();
kf.insert (4);
t = db::PropertiesTranslator::make_filter (kf, rp) * db::PropertiesTranslator::make_key_mapper (km, rp);
EXPECT_EQ (t.is_empty (), false);
EXPECT_EQ (db::prop2string (t (prop1a)), "4=>100");
EXPECT_EQ (db::prop2string (t (prop1b)), "4=>0");
EXPECT_EQ (db::prop2string (t (prop2)), "4=>100");
EXPECT_EQ (db::prop2string (t (prop3)), "4=>100");
EXPECT_EQ (db::prop2string (t (prop1a)), "{4=>100}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{4=>0}");
EXPECT_EQ (db::prop2string (t (prop2)), "{4=>100}");
EXPECT_EQ (db::prop2string (t (prop3)), "{4=>100}");
kf.clear ();
kf.insert (3);
t = db::PropertiesTranslator::make_filter (kf, rp) * db::PropertiesTranslator::make_key_mapper (km, rp);
EXPECT_EQ (t.is_empty (), true);
EXPECT_EQ (db::prop2string (t (prop1a)), "");
EXPECT_EQ (db::prop2string (t (prop1b)), "");
EXPECT_EQ (db::prop2string (t (prop2)), "");
EXPECT_EQ (db::prop2string (t (prop3)), "");
EXPECT_EQ (db::prop2string (t (prop1a)), "{}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{}");
EXPECT_EQ (db::prop2string (t (prop2)), "{}");
EXPECT_EQ (db::prop2string (t (prop3)), "{}");
t = db::PropertiesTranslator::make_key_mapper (km, rp) * db::PropertiesTranslator::make_filter (kf, rp);
EXPECT_EQ (t.is_empty (), false);
EXPECT_EQ (db::prop2string (t (prop1a)), "");
EXPECT_EQ (db::prop2string (t (prop1b)), "");
EXPECT_EQ (db::prop2string (t (prop2)), "1=>102");
EXPECT_EQ (db::prop2string (t (prop3)), "");
EXPECT_EQ (db::prop2string (t (prop1a)), "{}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{}");
EXPECT_EQ (db::prop2string (t (prop2)), "{1=>102}");
EXPECT_EQ (db::prop2string (t (prop3)), "{}");
t = db::PropertiesTranslator::make_key_mapper (km, rp);
t = db::PropertiesTranslator::make_filter (kf, rp) * t;
EXPECT_EQ (t.is_empty (), true);
EXPECT_EQ (db::prop2string (t (prop1a)), "");
EXPECT_EQ (db::prop2string (t (prop1b)), "");
EXPECT_EQ (db::prop2string (t (prop2)), "");
EXPECT_EQ (db::prop2string (t (prop3)), "");
EXPECT_EQ (db::prop2string (t (prop1a)), "{}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{}");
EXPECT_EQ (db::prop2string (t (prop2)), "{}");
EXPECT_EQ (db::prop2string (t (prop3)), "{}");
t = db::PropertiesTranslator::make_filter (kf, rp);
t = db::PropertiesTranslator::make_key_mapper (km, rp) * t;
EXPECT_EQ (t.is_empty (), false);
EXPECT_EQ (db::prop2string (t (prop1a)), "");
EXPECT_EQ (db::prop2string (t (prop1b)), "");
EXPECT_EQ (db::prop2string (t (prop2)), "1=>102");
EXPECT_EQ (db::prop2string (t (prop3)), "");
EXPECT_EQ (db::prop2string (t (prop1a)), "{}");
EXPECT_EQ (db::prop2string (t (prop1b)), "{}");
EXPECT_EQ (db::prop2string (t (prop2)), "{1=>102}");
EXPECT_EQ (db::prop2string (t (prop3)), "{}");
}

View File

@ -907,20 +907,31 @@ TEST(9)
EXPECT_EQ (si.at_end (), true);
db::PropertiesSet props;
props.insert (tl::Variant (1), "a");
db::properties_id_type pid1 = db::properties_id (props);
props.insert (tl::Variant (2), "b");
db::properties_id_type pid2 = db::properties_id (props);
props.clear ();
props.insert (tl::Variant (3), "x");
db::properties_id_type pid3 = db::properties_id (props);
s.clear ();
s.insert (db::PointWithProperties (db::Point (100, 200), 1));
s.insert (db::EdgeWithProperties (db::Edge (db::Point (100, 200), db::Point (200, 400)), 2));
s.insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (db::Point (100, 200), db::Point (200, 400)), db::Edge (db::Point (0, 300), db::Point (100, 500))), 3));
s.insert (db::PointWithProperties (db::Point (100, 200), pid1));
s.insert (db::EdgeWithProperties (db::Edge (db::Point (100, 200), db::Point (200, 400)), pid2));
s.insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (db::Point (100, 200), db::Point (200, 400)), db::Edge (db::Point (0, 300), db::Point (100, 500))), pid3));
si = s.begin (db::ShapeIterator::All);
EXPECT_EQ (si.at_end (), false);
EXPECT_EQ (si->is_edge (), true);
EXPECT_EQ (si->prop_id (), db::properties_id_type (2));
EXPECT_EQ (si->prop_id (), pid2);
EXPECT_EQ (si->is_edge_pair (), false);
EXPECT_EQ (si->is_point (), false);
EXPECT_EQ (si->to_string (), "edge (100,200;200,400) prop_id=2");
EXPECT_EQ (si->to_string (), "edge (100,200;200,400) props={1=>a,2=>b}");
EXPECT_EQ (si->edge ().to_string (), "(100,200;200,400)");
++si;
@ -928,10 +939,10 @@ TEST(9)
EXPECT_EQ (si.at_end (), false);
EXPECT_EQ (si->is_edge (), false);
EXPECT_EQ (si->is_edge_pair (), true);
EXPECT_EQ (si->prop_id (), db::properties_id_type (3));
EXPECT_EQ (si->prop_id (), pid3);
EXPECT_EQ (si->is_point (), false);
EXPECT_EQ (si->to_string (), "edge_pair (100,200;200,400)/(0,300;100,500) prop_id=3");
EXPECT_EQ (si->to_string (), "edge_pair (100,200;200,400)/(0,300;100,500) props={3=>x}");
EXPECT_EQ (si->edge_pair ().to_string (), "(100,200;200,400)/(0,300;100,500)");
++si;
@ -940,9 +951,9 @@ TEST(9)
EXPECT_EQ (si->is_edge (), false);
EXPECT_EQ (si->is_edge_pair (), false);
EXPECT_EQ (si->is_point (), true);
EXPECT_EQ (si->prop_id (), db::properties_id_type (1));
EXPECT_EQ (si->prop_id (), pid1);
EXPECT_EQ (si->to_string (), "point 100,200 prop_id=1");
EXPECT_EQ (si->to_string (), "point 100,200 props={1=>a}");
EXPECT_EQ (si->point ().to_string (), "100,200");
++si;

View File

@ -1466,13 +1466,13 @@ TEST(116)
"}\n"
"begin_libp $props 0.001\n"
"set props {\n"
" {{S_BOUNDING_BOX} {2,0,0,0,0}}\n"
" {{S_BOUNDING_BOX} {(2,0,0,0,0)}}\n"
"}\n"
"begin_cellp $props {$2}\n"
"end_cell\n"
"set props {\n"
" {42 {42}}\n"
" {{S_BOUNDING_BOX} {0,0,100,1000,1100}}\n"
" {{S_BOUNDING_BOX} {(0,0,100,1000,1100)}}\n"
"}\n"
"begin_cellp $props {$1}\n"
"path 1 0 0 0 0 {0 100} {1000 1200}\n"
@ -1532,14 +1532,14 @@ TEST(116)
"begin_libp $props 0.001\n"
"set props {\n"
" {42 {42}}\n"
" {{S_BOUNDING_BOX} {0,0,100,1000,1100}}\n"
" {{S_BOUNDING_BOX} {(0,0,100,1000,1100)}}\n"
" {{S_CELL_OFFSET} {231}}\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_BOUNDING_BOX} {2,0,0,0,0}}\n"
" {{S_BOUNDING_BOX} {(2,0,0,0,0)}}\n"
" {{S_CELL_OFFSET} {229}}\n"
"}\n"
"begin_cellp $props {$2}\n"

View File

@ -1224,6 +1224,24 @@ Variant::operator< (const tl::Variant &d) const
}
}
bool
Variant::equal (const Variant &d) const
{
if (m_type != d.m_type) {
return false;
}
return operator== (d);
}
bool
Variant::less (const Variant &d) const
{
if (m_type != d.m_type) {
return m_type < d.m_type;
}
return operator< (d);
}
bool
Variant::can_convert_to_float () const
{
@ -1834,13 +1852,16 @@ Variant::to_string () const
r = tl::to_string (*m_var.m_qstring);
#endif
} else if (m_type == t_list) {
r += "(";
for (std::vector<tl::Variant>::const_iterator v = m_var.m_list->begin (); v != m_var.m_list->end (); ++v) {
if (v != m_var.m_list->begin ()) {
r += ",";
}
r += v->to_string ();
}
r += ")";
} else if (m_type == t_array) {
r += "{";
for (const_array_iterator v = m_var.m_array->begin (); v != m_var.m_array->end (); ++v) {
if (v != m_var.m_array->begin ()) {
r += ",";
@ -1849,6 +1870,7 @@ Variant::to_string () const
r += "=>";
r += v->second.to_string ();
}
r += "}";
} else if (m_type == t_id) {
r = "[id" + tl::to_string (m_var.m_id) + "]";
} else if (m_type == t_user) {

View File

@ -725,6 +725,22 @@ public:
*/
bool operator< (const Variant &d) const;
/**
* @brief An exact compare
*
* In constrast to operator==, this method compares the two variants exactly -
* i.e. also the types have to be identical, not only the (normalized type) values.
*/
bool equal (const Variant &d) const;
/**
* @brief An exact less operator
*
* This is the companion for "equal". It is also an exact compare - i.e.
* the type codes are compared as well.
*/
bool less (const Variant &d) const;
/**
* @brief Conversion to a string
*

View File

@ -1164,10 +1164,15 @@ TEST(9)
mi[-1] = 31;
EXPECT_EQ (tl::Variant (vi).to_parsable_string (), "(#17,#1)");
EXPECT_EQ (tl::Variant (vi).to_string (), "(17,1)");
EXPECT_EQ (tl::Variant (li).to_parsable_string (), "(#42,#-17)");
EXPECT_EQ (tl::Variant (li).to_string (), "(42,-17)");
EXPECT_EQ (tl::Variant (si).to_parsable_string (), "(#31,#63)");
EXPECT_EQ (tl::Variant (si).to_string (), "(31,63)");
EXPECT_EQ (tl::Variant (pi).to_parsable_string (), "(#1,#3)");
EXPECT_EQ (tl::Variant (pi).to_string (), "(1,3)");
EXPECT_EQ (tl::Variant (mi).to_parsable_string (), "{#-1=>#31,#17=>#42}");
EXPECT_EQ (tl::Variant (mi).to_string (), "{-1=>31,17=>42}");
}
// special numeric values
@ -1324,6 +1329,22 @@ TEST(11)
EXPECT_EQ (tl::Variant ("B") < v, false);
EXPECT_EQ (tl::Variant ("A") < v, false);
EXPECT_EQ (tl::Variant (" ") < v, true);
// compare without type
EXPECT_EQ (tl::Variant (1l) == tl::Variant (1.0), true);
EXPECT_EQ (tl::Variant (1l) == tl::Variant (1.5), false);
EXPECT_EQ (tl::Variant (1l) < tl::Variant (1.0), false);
EXPECT_EQ (tl::Variant (1.0) < tl::Variant (1l), false);
EXPECT_EQ (tl::Variant (1l) < tl::Variant (1.5), true);
EXPECT_EQ (tl::Variant (1.5) < tl::Variant (1l), false);
// compare with type
EXPECT_EQ (tl::Variant (1l).equal (tl::Variant (1.0)), false);
EXPECT_EQ (tl::Variant (1l).equal (tl::Variant (1.5)), false);
EXPECT_EQ (tl::Variant (1l).less (tl::Variant (1.0)), true);
EXPECT_EQ (tl::Variant (1.0).less (tl::Variant (1l)), false);
EXPECT_EQ (tl::Variant (1l).less (tl::Variant (1.5)), true);
EXPECT_EQ (tl::Variant (1l).less (tl::Variant (0.5)), true);
}
// some tests originally from PropertiesRepositoryTests

View File

@ -1,36 +1,36 @@
begin_lib 0.001
begin_cell {A}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {0 2000} {100 2200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 0} {3000 100} {3100 100} {3100 50} {3150 50} {3150 0} {3000 0}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 3000} {100 3200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 4000} {100 4200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2000 0} {2150 0} {2150 50} {2100 50}
set props {
{{PROP0} {-5}}
}
boxp $props 1 2 {0 1000} {100 1200}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {0 2000} {100 2200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 0} {3000 100} {3100 100} {3100 50} {3150 50} {3150 0} {3000 0}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 3000} {100 3200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 4000} {100 4200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2000 0} {2150 0} {2150 50} {2100 50}
set props {
{{PROPX} {nil}}
}
boxp $props 1 2 {0 0} {100 200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1000 0} {A}
end_cell

View File

@ -1,5 +1,131 @@
begin_lib 0.001
begin_cell {A}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {0 2000} {100 2200}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {0 2320} {100 2520}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {300 2000} {400 2200}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {300 2320} {400 2520}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {600 2000} {700 2200}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {600 2320} {700 2520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 0} {3000 100} {3100 100} {3100 50} {3150 50} {3150 0} {3000 0}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 320} {3000 420} {3100 420} {3100 370} {3150 370} {3150 320} {3000 320}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3300 0} {3300 100} {3400 100} {3400 50} {3450 50} {3450 0} {3300 0}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3300 320} {3300 420} {3400 420} {3400 370} {3450 370} {3450 320} {3300 320}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3600 0} {3600 100} {3700 100} {3700 50} {3750 50} {3750 0} {3600 0}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3600 320} {3600 420} {3700 420} {3700 370} {3750 370} {3750 320} {3600 320}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 3000} {100 3200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 3320} {100 3520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 4000} {100 4200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 4320} {100 4520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {300 3000} {400 3200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {300 3320} {400 3520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {300 4000} {400 4200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {300 4320} {400 4520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {600 3000} {700 3200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {600 3320} {700 3520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {600 4000} {700 4200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {600 4320} {700 4520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2000 0} {2150 0} {2150 50} {2100 50}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2000 320} {2150 320} {2150 370} {2100 370}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2300 0} {2450 0} {2450 50} {2400 50}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2300 320} {2450 320} {2450 370} {2400 370}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2600 0} {2750 0} {2750 50} {2700 50}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2600 320} {2750 320} {2750 370} {2700 370}
set props {
{{PROP0} {-5}}
}
@ -24,132 +150,6 @@ set props {
{{PROP0} {-5}}
}
boxp $props 1 2 {600 1320} {700 1520}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {0 2000} {100 2200}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {0 2320} {100 2520}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {300 2000} {400 2200}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {300 2320} {400 2520}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {600 2000} {700 2200}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {600 2320} {700 2520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 0} {3000 100} {3100 100} {3100 50} {3150 50} {3150 0} {3000 0}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 320} {3000 420} {3100 420} {3100 370} {3150 370} {3150 320} {3000 320}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3300 0} {3300 100} {3400 100} {3400 50} {3450 50} {3450 0} {3300 0}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3300 320} {3300 420} {3400 420} {3400 370} {3450 370} {3450 320} {3300 320}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3600 0} {3600 100} {3700 100} {3700 50} {3750 50} {3750 0} {3600 0}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3600 320} {3600 420} {3700 420} {3700 370} {3750 370} {3750 320} {3600 320}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 3000} {100 3200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 3320} {100 3520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 4000} {100 4200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 4320} {100 4520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {300 3000} {400 3200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {300 3320} {400 3520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {300 4000} {400 4200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {300 4320} {400 4520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {600 3000} {700 3200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {600 3320} {700 3520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {600 4000} {700 4200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {600 4320} {700 4520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2000 0} {2150 0} {2150 50} {2100 50}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2000 320} {2150 320} {2150 370} {2100 370}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2300 0} {2450 0} {2450 50} {2400 50}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2300 320} {2450 320} {2450 370} {2400 370}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2600 0} {2750 0} {2750 50} {2700 50}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2600 320} {2750 320} {2750 370} {2700 370}
set props {
{{PROPX} {nil}}
}
@ -175,27 +175,27 @@ set props {
}
boxp $props 1 2 {600 320} {700 520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1000 0} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1000 320} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1300 0} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1300 320} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1600 0} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1600 320} {A}
end_cell

View File

@ -1,5 +1,131 @@
begin_lib 0.001
begin_cell {A}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {0 2000} {100 2200}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {0 2320} {100 2520}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {300 2000} {400 2200}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {300 2320} {400 2520}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {600 2000} {700 2200}
set props {
{{PROP0} {(25,-124,PROP_VALUE2,PropStringId12)}}
}
boxp $props 1 2 {600 2320} {700 2520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 0} {3000 100} {3100 100} {3100 50} {3150 50} {3150 0} {3000 0}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 320} {3000 420} {3100 420} {3100 370} {3150 370} {3150 320} {3000 320}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3300 0} {3300 100} {3400 100} {3400 50} {3450 50} {3450 0} {3300 0}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3300 320} {3300 420} {3400 420} {3400 370} {3450 370} {3450 320} {3300 320}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3600 0} {3600 100} {3700 100} {3700 50} {3750 50} {3750 0} {3600 0}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3600 320} {3600 420} {3700 420} {3700 370} {3750 370} {3750 320} {3600 320}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 3000} {100 3200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 3320} {100 3520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 4000} {100 4200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {0 4320} {100 4520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {300 3000} {400 3200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {300 3320} {400 3520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {300 4000} {400 4200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {300 4320} {400 4520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {600 3000} {700 3200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {600 3320} {700 3520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {600 4000} {700 4200}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
boxp $props 1 2 {600 4320} {700 4520}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2000 0} {2150 0} {2150 50} {2100 50}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2000 320} {2150 320} {2150 370} {2100 370}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2300 0} {2450 0} {2450 50} {2400 50}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2300 320} {2450 320} {2450 370} {2400 370}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2600 0} {2750 0} {2750 50} {2700 50}
set props {
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
pathp $props 1 2 20 5 -5 {2600 320} {2750 320} {2750 370} {2700 370}
set props {
{{PROP0} {-5}}
}
@ -24,132 +150,6 @@ set props {
{{PROP0} {-5}}
}
boxp $props 1 2 {600 1320} {700 1520}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {0 2000} {100 2200}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {0 2320} {100 2520}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {300 2000} {400 2200}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {300 2320} {400 2520}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {600 2000} {700 2200}
set props {
{{PROP0} {25,-124,PROP_VALUE2,PropStringId12}}
}
boxp $props 1 2 {600 2320} {700 2520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 0} {3000 100} {3100 100} {3100 50} {3150 50} {3150 0} {3000 0}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3000 320} {3000 420} {3100 420} {3100 370} {3150 370} {3150 320} {3000 320}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3300 0} {3300 100} {3400 100} {3400 50} {3450 50} {3450 0} {3300 0}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3300 320} {3300 420} {3400 420} {3400 370} {3450 370} {3450 320} {3300 320}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3600 0} {3600 100} {3700 100} {3700 50} {3750 50} {3750 0} {3600 0}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP1} {nil}}
}
boundaryp $props 1 2 {3600 320} {3600 420} {3700 420} {3700 370} {3750 370} {3750 320} {3600 320}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 3000} {100 3200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 3320} {100 3520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 4000} {100 4200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {0 4320} {100 4520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {300 3000} {400 3200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {300 3320} {400 3520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {300 4000} {400 4200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {300 4320} {400 4520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {600 3000} {700 3200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {600 3320} {700 3520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {600 4000} {700 4200}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
boxp $props 1 2 {600 4320} {700 4520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2000 0} {2150 0} {2150 50} {2100 50}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2000 320} {2150 320} {2150 370} {2100 370}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2300 0} {2450 0} {2450 50} {2400 50}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2300 320} {2450 320} {2450 370} {2400 370}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2600 0} {2750 0} {2750 50} {2700 50}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
}
pathp $props 1 2 20 5 -5 {2600 320} {2750 320} {2750 370} {2700 370}
set props {
{{PROPX} {nil}}
}
@ -175,27 +175,27 @@ set props {
}
boxp $props 1 2 {600 320} {700 520}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1000 0} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1000 320} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1300 0} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1300 320} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1600 0} {A}
set props {
{{PROP0} {25,-124,Property string value for ID 13}}
{{PROP0} {(25,-124,Property string value for ID 13)}}
}
textp $props 2 1 0 0 {1600 320} {A}
end_cell

View File

@ -824,15 +824,6 @@ class DBLayoutTest(unittest.TestCase):
if r != "":
r += ";"
r += s.to_s()
if s.prop_id > 0:
pr = ""
for pp in ly.properties(s.prop_id):
if pr != "":
pr += ","
pr += str(pp[0]) + "=>" + str(pp[1])
r += "["
r += pr
r += "]"
return r
# Copy/move between cells
@ -856,9 +847,9 @@ class DBLayoutTest(unittest.TestCase):
ca1.copy(la1, lb1)
cb1.copy(ca1, la1, lb1)
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(lb1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly1, cb1.shapes(lb1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) props={17=>hallo}")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(lb1)), "box (0,500;1000,2000) props={17=>hallo}")
self.assertEqual(self.shapes_to_s(ly1, cb1.shapes(lb1)), "box (0,500;1000,2000) props={17=>hallo}")
self.assertEqual(self.shapes_to_s(ly1, cb1.shapes(la1)), "")
ly2 = pya.Layout()
@ -869,8 +860,8 @@ class DBLayoutTest(unittest.TestCase):
cb2 = ly2.cell(ly2.add_cell("b"))
ca2.copy(ca1, la1, lb2)
self.assertEqual(self.shapes_to_s(ly2, ca2.shapes(lb2)), "box (0,1000;2000,4000) prop_id=1[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly2, ca2.shapes(lb2)), "box (0,1000;2000,4000) props={17=>hallo}")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) props={17=>hallo}")
# move
ca1.clear()
@ -881,16 +872,16 @@ class DBLayoutTest(unittest.TestCase):
s1 = ca1.shapes(la1).insert(pya.Box(0, 500, 1000, 2000))
s1.set_property(17, 5.0)
s1.set_property(17, "hallo")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) props={17=>hallo}")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(lb1)), "")
ca1.move(la1, lb1)
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(la1)), "")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(lb1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(lb1)), "box (0,500;1000,2000) props={17=>hallo}")
cb1.move(ca1, lb1, lb1)
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(la1)), "")
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(lb1)), "")
self.assertEqual(self.shapes_to_s(ly1, cb1.shapes(lb1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly1, cb1.shapes(lb1)), "box (0,500;1000,2000) props={17=>hallo}")
self.assertEqual(self.shapes_to_s(ly1, cb1.shapes(la1)), "")
ly2 = pya.Layout()
@ -905,7 +896,7 @@ class DBLayoutTest(unittest.TestCase):
self.assertEqual(self.shapes_to_s(ly1, ca1.shapes(lb1)), "")
self.assertEqual(self.shapes_to_s(ly1, cb1.shapes(lb1)), "")
self.assertEqual(self.shapes_to_s(ly1, cb1.shapes(la1)), "")
self.assertEqual(self.shapes_to_s(ly2, ca2.shapes(lb2)), "box (0,1000;2000,4000) prop_id=1[17=>hallo]")
self.assertEqual(self.shapes_to_s(ly2, ca2.shapes(lb2)), "box (0,1000;2000,4000) props={17=>hallo}")
# top cells
def test_8(self):
@ -1077,17 +1068,20 @@ class DBLayoutTest(unittest.TestCase):
ly = pya.Layout()
pid1 = ly.properties_id({ "x": 1 })
pid2 = ly.properties_id({ "x": 17 })
self.assertEqual(ly.prop_id, 0)
ly.prop_id = 1
self.assertEqual(ly.prop_id, 1)
ly.prop_id = pid1
self.assertEqual(ly.prop_id, pid1)
ly.prop_id = 0
self.assertEqual(ly.prop_id, 0)
ly.set_property("x", 1)
self.assertEqual(ly.prop_id, 1)
self.assertEqual(ly.prop_id, pid1)
self.assertEqual(ly.property("x"), 1)
ly.set_property("x", 17)
self.assertEqual(ly.prop_id, 2)
self.assertEqual(ly.prop_id, pid2)
self.assertEqual(ly.property("x"), 17)
self.assertEqual(ly.property("y"), None)

View File

@ -1752,19 +1752,22 @@ class DBLayoutTests1_TestClass < TestBase
ly = RBA::Layout::new
pid1 = ly.properties_id({ "x" => 1 })
pid2 = ly.properties_id({ "x" => 17 })
cell = ly.create_cell("X")
assert_equal(cell.prop_id, 0)
cell.prop_id = 1
assert_equal(cell.prop_id, 1)
cell.prop_id = pid1
assert_equal(cell.prop_id, pid1)
cell.prop_id = 0
assert_equal(cell.prop_id, 0)
cell.set_property("x", 1)
assert_equal(cell.prop_id, 1)
assert_equal(cell.prop_id, pid1)
assert_equal(cell.property("x"), 1)
cell.set_property("x", 17)
assert_equal(cell.prop_id, 2)
assert_equal(cell.prop_id, pid2)
assert_equal(cell.property("x"), 17)
assert_equal(cell.property("y"), nil)

View File

@ -808,16 +808,6 @@ class DBLayoutTests2_TestClass < TestBase
shapes.each do |s|
r == "" || (r += ";")
r += s.to_s
if s.prop_id > 0
pr = ""
ly.properties(s.prop_id).each do |pp|
pr == "" || (pr += ",")
pr += pp[0].to_s + "=>" + pp[1].to_s
end
r += "["
r += pr
r += "]"
end
end
r
end
@ -838,9 +828,9 @@ class DBLayoutTests2_TestClass < TestBase
ca1.copy(la1, lb1)
cb1.copy(ca1, la1, lb1)
assert_equal(shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
assert_equal(shapes_to_s(ly1, ca1.shapes(lb1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
assert_equal(shapes_to_s(ly1, cb1.shapes(lb1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
assert_equal(shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) props={17=>hallo}")
assert_equal(shapes_to_s(ly1, ca1.shapes(lb1)), "box (0,500;1000,2000) props={17=>hallo}")
assert_equal(shapes_to_s(ly1, cb1.shapes(lb1)), "box (0,500;1000,2000) props={17=>hallo}")
assert_equal(shapes_to_s(ly1, cb1.shapes(la1)), "")
ly2 = RBA::Layout::new
@ -851,8 +841,8 @@ class DBLayoutTests2_TestClass < TestBase
cb2 = ly2.cell(ly2.add_cell("b"))
ca2.copy(ca1, la1, lb2)
assert_equal(shapes_to_s(ly2, ca2.shapes(lb2)), "box (0,1000;2000,4000) prop_id=1[17=>hallo]")
assert_equal(shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
assert_equal(shapes_to_s(ly2, ca2.shapes(lb2)), "box (0,1000;2000,4000) props={17=>hallo}")
assert_equal(shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) props={17=>hallo}")
# move
ca1.clear
@ -863,16 +853,16 @@ class DBLayoutTests2_TestClass < TestBase
s1 = ca1.shapes(la1).insert(RBA::Box::new(0, 500, 1000, 2000))
s1.set_property(17, 5.0)
s1.set_property(17, "hallo")
assert_equal(shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
assert_equal(shapes_to_s(ly1, ca1.shapes(la1)), "box (0,500;1000,2000) props={17=>hallo}")
assert_equal(shapes_to_s(ly1, ca1.shapes(lb1)), "")
ca1.move(la1, lb1)
assert_equal(shapes_to_s(ly1, ca1.shapes(la1)), "")
assert_equal(shapes_to_s(ly1, ca1.shapes(lb1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
assert_equal(shapes_to_s(ly1, ca1.shapes(lb1)), "box (0,500;1000,2000) props={17=>hallo}")
cb1.move(ca1, lb1, lb1)
assert_equal(shapes_to_s(ly1, ca1.shapes(la1)), "")
assert_equal(shapes_to_s(ly1, ca1.shapes(lb1)), "")
assert_equal(shapes_to_s(ly1, cb1.shapes(lb1)), "box (0,500;1000,2000) prop_id=2[17=>hallo]")
assert_equal(shapes_to_s(ly1, cb1.shapes(lb1)), "box (0,500;1000,2000) props={17=>hallo}")
assert_equal(shapes_to_s(ly1, cb1.shapes(la1)), "")
ly2 = RBA::Layout::new
@ -887,7 +877,7 @@ class DBLayoutTests2_TestClass < TestBase
assert_equal(shapes_to_s(ly1, ca1.shapes(lb1)), "")
assert_equal(shapes_to_s(ly1, cb1.shapes(lb1)), "")
assert_equal(shapes_to_s(ly1, cb1.shapes(la1)), "")
assert_equal(shapes_to_s(ly2, ca2.shapes(lb2)), "box (0,1000;2000,4000) prop_id=1[17=>hallo]")
assert_equal(shapes_to_s(ly2, ca2.shapes(lb2)), "box (0,1000;2000,4000) props={17=>hallo}")
end
@ -1042,14 +1032,17 @@ class DBLayoutTests2_TestClass < TestBase
ly = RBA::Layout::new
assert_equal(ly.properties, {})
pid1 = ly.properties_id({ "x" => 1 })
pid2 = ly.properties_id({ "x" => 17 })
assert_equal(ly.prop_id, 0)
ly.prop_id = 1
assert_equal(ly.prop_id, 1)
ly.prop_id = pid1
assert_equal(ly.prop_id, pid1)
ly.prop_id = 0
assert_equal(ly.prop_id, 0)
ly.set_property("x", 1)
assert_equal(ly.prop_id, 1)
assert_equal(ly.prop_id, pid1)
assert_equal(ly.property("x"), 1)
assert_equal(ly.properties, {"x" => 1})
assert_equal(ly.properties_hash(ly.prop_id), {"x" => 1})
@ -1057,7 +1050,7 @@ class DBLayoutTests2_TestClass < TestBase
assert_equal(ly.properties_array(ly.prop_id), [["x", 1]])
assert_equal(ly.properties_id(ly.properties_array(ly.prop_id)), ly.prop_id)
ly.set_property("x", 17)
assert_equal(ly.prop_id, 2)
assert_equal(ly.prop_id, pid2)
assert_equal(ly.property("x"), 17)
assert_equal(ly.property("y"), nil)

View File

@ -734,6 +734,9 @@ class DBShapes_TestClass < TestBase
ly = RBA::Layout::new
pid5 = ly.properties_id( { "id" => 5 } )
pid8 = ly.properties_id( { "id" => 8 } )
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@ -746,29 +749,27 @@ class DBShapes_TestClass < TestBase
c2 = ly.cell( ci2 )
c1.shapes( lindex ).insert( RBA::Box::new( 10, -10, 50, 40 ) )
c1.shapes( lindex ).insert( RBA::Box::new( 100, -10, 150, 40 ), 5 )
c1.shapes( lindex ).insert( RBA::Box::new( 200, -10, 250, 40 ), 8 )
c1.shapes( lindex ).insert( RBA::Box::new( 100, -10, 150, 40 ), pid5 )
c1.shapes( lindex ).insert( RBA::Box::new( 200, -10, 250, 40 ), pid8 )
shapes = c1.shapes( lindex )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.box.to_s ); arr.push( s.prop_id ) }
assert_equal( arr, [ "(10,-10;50,40)", 0, "(100,-10;150,40)", 5, "(200,-10;250,40)", 8 ] )
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.box.to_s ); arr.push( s.properties.to_s ) }
assert_equal( arr, [ "(10,-10;50,40)", "{}", "(100,-10;150,40)", "{\"id\"=>5}", "(200,-10;250,40)", "{\"id\"=>8}" ] )
assert_equal( ly.properties( 17 ), [] )
assert_equal( ly.properties_id( { 17 => "a", "b" => [ 1, 5, 7 ] }.to_a ), 1 )
assert_equal( ly.properties_id( { 17 => "a", "b" => [ 1, 5, 7 ] }.to_a ), 1 )
assert_equal( ly.properties_id( { 17 => "a", "b" => [ 1, 5, 8 ] }.to_a ), 2 )
assert_equal( ly.properties_id( { [1,2] => "hallo", 5 => nil }.to_a ), 3 )
pid1 = ly.properties_id( { 17 => "a", "b" => [ 1, 5, 7 ] }.to_a )
pid2 = ly.properties_id( { 17 => "a", "b" => [ 1, 5, 8 ] }.to_a )
pid3 = ly.properties_id( { [1,2] => "hallo", 5 => nil }.to_a )
h = {}
ly.properties( 1 ).each { |p| h[p[0]] = p[1] }
ly.properties( pid1 ).each { |p| h[p[0]] = p[1] }
assert_equal( h, { 17 => "a", "b" => [ 1, 5, 7 ] } )
h = {}
ly.properties( 2 ).each { |p| h[p[0]] = p[1] }
ly.properties( pid2 ).each { |p| h[p[0]] = p[1] }
assert_equal( h, { 17 => "a", "b" => [ 1, 5, 8 ] } )
h = {}
ly.properties( 3 ).each { |p| h[p[0]] = p[1] }
ly.properties( pid3 ).each { |p| h[p[0]] = p[1] }
assert_equal( h, { [1,2] => "hallo", 5 => nil } )
end
@ -778,6 +779,8 @@ class DBShapes_TestClass < TestBase
ly = RBA::Layout::new(true)
pid17 = ly.properties_id( { "id" => 17 } )
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@ -892,29 +895,29 @@ class DBShapes_TestClass < TestBase
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "simple_polygon (14,0;-21,35;7,64;42,28)"] )
s2 = shapes.replace_prop_id( s2, 17 )
s2 = shapes.replace_prop_id( s2, pid17 )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "simple_polygon (14,0;-21,35;7,64;42,28) prop_id=17"] )
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "simple_polygon (14,0;-21,35;7,64;42,28) props={id=>17}"] )
s2 = shapes.replace( s2, RBA::Box::new( 10, -10, 50, 40 ) )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "box (10,-10;50,40) prop_id=17"] )
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "box (10,-10;50,40) props={id=>17}"] )
s2 = shapes.replace( s2, RBA::Edge::new( 10, -10, 50, 40 ) )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "edge (10,-10;50,40) prop_id=17"] )
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "edge (10,-10;50,40) props={id=>17}"] )
s2 = shapes.replace( s2, RBA::EdgePair::new( RBA::Edge::new( 10, -10, 50, 40 ), RBA::Edge::new( 10, 0, 50, 30 ) ) )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "edge_pair (10,-10;50,40)/(10,0;50,30) prop_id=17"] )
assert_equal( arr, ["simple_polygon (14,0;-21,35;7,64;42,28)", "edge_pair (10,-10;50,40)/(10,0;50,30) props={id=>17}"] )
shapes.erase( s2 )
@ -935,6 +938,8 @@ class DBShapes_TestClass < TestBase
ly = RBA::Layout::new(true)
pid1 = ly.properties_id( { "id" => 1 } )
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@ -1016,70 +1021,70 @@ class DBShapes_TestClass < TestBase
assert_equal( s1.prop_id, 0 )
assert_equal( s1.has_prop_id?, false )
s1.prop_id = 1
assert_equal( s1.prop_id, 1 )
s1.prop_id = pid1
assert_equal( s1.prop_id, pid1 )
assert_equal( s1.has_prop_id?, true )
shapes = c1.shapes( lindex )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["polygon (100,200;500,600;400,300) prop_id=1", "edge (1,2;3,4)", "text ('text',r0 100,200)"] )
assert_equal( arr, ["polygon (100,200;500,600;400,300) props={id=>1}", "edge (1,2;3,4)", "text ('text',r0 100,200)"] )
s1.path = RBA::Path::new( [ RBA::Point::new( 0, 10 ), RBA::Point::new( 10, 50 ) ], 25 )
assert_equal( s1.to_s, "path (0,10;10,50) w=25 bx=0 ex=0 r=false prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=25 bx=0 ex=0 r=false props={id=>1}" )
s1.path_width = 12
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=0 ex=0 r=false prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=0 ex=0 r=false props={id=>1}" )
assert_equal( s1.path_width, 12 )
s1.path_bgnext = 1
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=0 r=false prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=0 r=false props={id=>1}" )
assert_equal( s1.path_bgnext, 1 )
s1.path_endext = 2
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=2 r=false prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=2 r=false props={id=>1}" )
assert_equal( s1.path_endext, 2 )
s1.round_path = true
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=2 r=true prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=2 r=true props={id=>1}" )
assert_equal( s1.round_path?, true )
shapes = c1.shapes( lindex )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["edge (1,2;3,4)", "path (0,10;10,50) w=12 bx=1 ex=2 r=true prop_id=1", "text ('text',r0 100,200)"] )
assert_equal( arr, ["edge (1,2;3,4)", "path (0,10;10,50) w=12 bx=1 ex=2 r=true props={id=>1}", "text ('text',r0 100,200)"] )
s1.box = RBA::Box::new(0, 10, 20, 40)
assert_equal( s1.to_s, "box (0,10;20,40) prop_id=1" )
assert_equal( s1.to_s, "box (0,10;20,40) props={id=>1}" )
assert_equal( s1.box_width.to_s, "20" )
s1.box_width = 30
assert_equal( s1.to_s, "box (-5,10;25,40) prop_id=1" )
assert_equal( s1.to_s, "box (-5,10;25,40) props={id=>1}" )
assert_equal( s1.box_width.to_s, "30" )
assert_equal( s1.box_height.to_s, "30" )
s1.box_height = 40
assert_equal( s1.to_s, "box (-5,5;25,45) prop_id=1" )
assert_equal( s1.to_s, "box (-5,5;25,45) props={id=>1}" )
assert_equal( s1.box_height.to_s, "40" )
assert_equal( s1.box_p1.to_s, "-5,5" )
s1.box_p1 = RBA::Point::new(0, 0)
assert_equal( s1.to_s, "box (0,0;25,45) prop_id=1" )
assert_equal( s1.to_s, "box (0,0;25,45) props={id=>1}" )
assert_equal( s1.box_p1.to_s, "0,0" )
assert_equal( s1.box_p2.to_s, "25,45" )
s1.box_p2 = RBA::Point::new(10, 20)
assert_equal( s1.to_s, "box (0,0;10,20) prop_id=1" )
assert_equal( s1.to_s, "box (0,0;10,20) props={id=>1}" )
assert_equal( s1.box_p2.to_s, "10,20" )
assert_equal( s1.box_center.to_s, "5,10" )
s1.box_center = RBA::Point::new(-10, -20)
assert_equal( s1.to_s, "box (-15,-30;-5,-10) prop_id=1" )
assert_equal( s1.to_s, "box (-15,-30;-5,-10) props={id=>1}" )
assert_equal( s1.box_center.to_s, "-10,-20" )
s1.text = RBA::Text::new( "text", RBA::Trans::new( RBA::Point::new( 100, 200 ) ) )
assert_equal( s1.to_s, "text ('text',r0 100,200) prop_id=1" )
assert_equal( s1.to_s, "text ('text',r0 100,200) props={id=>1}" )
s1.text_string = "blabla"
assert_equal( s1.to_s, "text ('blabla',r0 100,200) prop_id=1" )
assert_equal( s1.to_s, "text ('blabla',r0 100,200) props={id=>1}" )
assert_equal( s1.text_string, "blabla" )
s1.text_halign = 1
@ -1106,7 +1111,7 @@ class DBShapes_TestClass < TestBase
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["edge (1,2;3,4)", "text ('text',r0 100,200)", "text ('blabla',m0 100,200) f=3 ha=c va=b prop_id=1"] )
assert_equal( arr, ["edge (1,2;3,4)", "text ('text',r0 100,200)", "text ('blabla',m0 100,200) f=3 ha=c va=b props={id=>1}"] )
assert_equal( s1.is_valid?, true )
assert_equal( s1.shapes.is_valid?(s1), true )
@ -1158,6 +1163,8 @@ class DBShapes_TestClass < TestBase
ly = RBA::Layout::new(true)
pid1 = ly.properties_id( { 1 => "one" } )
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@ -1230,70 +1237,70 @@ class DBShapes_TestClass < TestBase
assert_equal( s1.prop_id, 0 )
assert_equal( s1.has_prop_id?, false )
s1.prop_id = 1
assert_equal( s1.prop_id, 1 )
s1.prop_id = pid1
assert_equal( s1.prop_id, pid1 )
assert_equal( s1.has_prop_id?, true )
shapes = c1.shapes( lindex )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["polygon (100,200;500,600;400,300) prop_id=1", "edge (1,2;3,4)", "text ('text',r0 100,200)"] )
assert_equal( arr, ["polygon (100,200;500,600;400,300) props={1=>one}", "edge (1,2;3,4)", "text ('text',r0 100,200)"] )
s1.path = RBA::DPath::new( [ RBA::DPoint::new( 0, 0.010 ), RBA::DPoint::new( 0.010, 0.050 ) ], 0.025 )
assert_equal( s1.to_s, "path (0,10;10,50) w=25 bx=0 ex=0 r=false prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=25 bx=0 ex=0 r=false props={1=>one}" )
s1.path_dwidth = 0.012
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=0 ex=0 r=false prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=0 ex=0 r=false props={1=>one}" )
assert_equal( "%.12g" % s1.path_dwidth, "0.012" )
s1.path_dbgnext = 0.001
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=0 r=false prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=0 r=false props={1=>one}" )
assert_equal( "%.12g" % s1.path_dbgnext, "0.001" )
s1.path_dendext = 0.002
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=2 r=false prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=2 r=false props={1=>one}" )
assert_equal( "%.12g" % s1.path_dendext, "0.002" )
s1.round_path = true
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=2 r=true prop_id=1" )
assert_equal( s1.to_s, "path (0,10;10,50) w=12 bx=1 ex=2 r=true props={1=>one}" )
assert_equal( s1.round_path?, true )
shapes = c1.shapes( lindex )
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["edge (1,2;3,4)", "path (0,10;10,50) w=12 bx=1 ex=2 r=true prop_id=1", "text ('text',r0 100,200)"] )
assert_equal( arr, ["edge (1,2;3,4)", "path (0,10;10,50) w=12 bx=1 ex=2 r=true props={1=>one}", "text ('text',r0 100,200)"] )
s1.box = RBA::DBox::new(0, 0.010, 0.020, 0.040)
assert_equal( s1.to_s, "box (0,10;20,40) prop_id=1" )
assert_equal( s1.to_s, "box (0,10;20,40) props={1=>one}" )
assert_equal( s1.box_dwidth.to_s, "0.02" )
s1.box_dwidth = 0.03
assert_equal( s1.to_s, "box (-5,10;25,40) prop_id=1" )
assert_equal( s1.to_s, "box (-5,10;25,40) props={1=>one}" )
assert_equal( s1.box_dwidth.to_s, "0.03" )
assert_equal( s1.box_dheight.to_s, "0.03" )
s1.box_dheight = 0.04
assert_equal( s1.to_s, "box (-5,5;25,45) prop_id=1" )
assert_equal( s1.to_s, "box (-5,5;25,45) props={1=>one}" )
assert_equal( s1.box_dheight.to_s, "0.04" )
assert_equal( s1.box_dp1.to_s, "-0.005,0.005" )
s1.box_dp1 = RBA::DPoint::new(0, 0)
assert_equal( s1.to_s, "box (0,0;25,45) prop_id=1" )
assert_equal( s1.to_s, "box (0,0;25,45) props={1=>one}" )
assert_equal( s1.box_dp1.to_s, "0,0" )
assert_equal( s1.box_dp2.to_s, "0.025,0.045" )
s1.box_dp2 = RBA::DPoint::new(0.010, 0.020)
assert_equal( s1.to_s, "box (0,0;10,20) prop_id=1" )
assert_equal( s1.to_s, "box (0,0;10,20) props={1=>one}" )
assert_equal( s1.box_dp2.to_s, "0.01,0.02" )
assert_equal( s1.box_dcenter.to_s, "0.005,0.01" )
s1.box_dcenter = RBA::DPoint::new(-0.010, -0.020)
assert_equal( s1.to_s, "box (-15,-30;-5,-10) prop_id=1" )
assert_equal( s1.to_s, "box (-15,-30;-5,-10) props={1=>one}" )
assert_equal( s1.box_dcenter.to_s, "-0.01,-0.02" )
s1.text = RBA::DText::new( "text", RBA::DTrans::new( RBA::DPoint::new( 0.100, 0.200 ) ) )
assert_equal( s1.to_s, "text ('text',r0 100,200) prop_id=1" )
assert_equal( s1.to_s, "text ('text',r0 100,200) props={1=>one}" )
s1.text_string = "blabla"
assert_equal( s1.to_s, "text ('blabla',r0 100,200) prop_id=1" )
assert_equal( s1.to_s, "text ('blabla',r0 100,200) props={1=>one}" )
assert_equal( s1.text_string, "blabla" )
s1.text_halign = 1
@ -1320,7 +1327,7 @@ class DBShapes_TestClass < TestBase
arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["edge (1,2;3,4)", "text ('text',r0 100,200)", "text ('blabla',m0 100,200) f=3 ha=c va=b prop_id=1"] )
assert_equal( arr, ["edge (1,2;3,4)", "text ('text',r0 100,200)", "text ('blabla',m0 100,200) f=3 ha=c va=b props={1=>one}"] )
assert_equal( s1.is_valid?, true )
assert_equal( s1.shapes.is_valid?(s1), true )