Supporting to_bytes and from_bytes also for the ..WithProperties types

This commit is contained in:
Matthias Koefferlein
2026-05-03 18:10:00 +02:00
parent 1de28f2d6b
commit 77fb74e072
4 changed files with 105 additions and 0 deletions
+14
View File
@@ -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