mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-01 02:18:09 +02:00
Supporting to_bytes and from_bytes also for the ..WithProperties types
This commit is contained in:
Vendored
+14
@@ -552,6 +552,20 @@ class DBBox_TestClass < TestBase
|
||||
assert_equal(s.to_s, "(0,0;100,200) props={}")
|
||||
assert_equal(s.property(1), nil)
|
||||
|
||||
# binary serialization
|
||||
|
||||
s = RBA::BoxWithProperties::new(RBA::Box::new(0, 0, 100, 200), {})
|
||||
assert_equal(RBA::BoxWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
|
||||
s = RBA::BoxWithProperties::new(RBA::Box::new(0, 0, 100, 200), { 1 => "one", "key" => 17 })
|
||||
assert_equal(RBA::BoxWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
|
||||
s = RBA::DBoxWithProperties::new(RBA::DBox::new(0, 0, 100, 200), {})
|
||||
assert_equal(RBA::DBoxWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
|
||||
s = RBA::DBoxWithProperties::new(RBA::DBox::new(0, 0, 100, 200), { 1 => "one", "key" => 17 })
|
||||
assert_equal(RBA::DBoxWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Vendored
+18
@@ -990,6 +990,24 @@ class DBPolygon_TestClass < TestBase
|
||||
assert_equal(s.class.to_s, "RBA::DSimplePolygonWithProperties")
|
||||
assert_equal(s.downcast.class.to_s, "RBA::DSimplePolygon")
|
||||
|
||||
# binary serialization
|
||||
s = RBA::PolygonWithProperties::new(RBA::Box::new(0, 0, 100, 200), {})
|
||||
assert_equal(RBA::PolygonWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
s = RBA::PolygonWithProperties::new(RBA::Box::new(0, 0, 100, 200), { 1 => "one", "key" => 17 })
|
||||
assert_equal(RBA::PolygonWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
s = RBA::DPolygonWithProperties::new(RBA::DBox::new(0, 0, 100, 200), {})
|
||||
assert_equal(RBA::DPolygonWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
s = RBA::DPolygonWithProperties::new(RBA::DBox::new(0, 0, 100, 200), { 1 => "one", "key" => 17 })
|
||||
assert_equal(RBA::DPolygonWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
s = RBA::SimplePolygonWithProperties::new(RBA::Box::new(0, 0, 100, 200), {})
|
||||
assert_equal(RBA::SimplePolygonWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
s = RBA::SimplePolygonWithProperties::new(RBA::Box::new(0, 0, 100, 200), { 1 => "one", "key" => 17 })
|
||||
assert_equal(RBA::SimplePolygonWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
s = RBA::DSimplePolygonWithProperties::new(RBA::DBox::new(0, 0, 100, 200), {})
|
||||
assert_equal(RBA::DSimplePolygonWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
s = RBA::DSimplePolygonWithProperties::new(RBA::DBox::new(0, 0, 100, 200), { 1 => "one", "key" => 17 })
|
||||
assert_equal(RBA::DSimplePolygonWithProperties::from_bytes(s.to_bytes).to_s, s.to_s)
|
||||
|
||||
end
|
||||
|
||||
def test_triangulation
|
||||
|
||||
Reference in New Issue
Block a user