Fixing issue #1942 (PythonStandalone Package stubs errors), adding defaults for Box#enlarge and Box#enlarged (bonus)

This commit is contained in:
Matthias Koefferlein 2024-12-02 22:01:51 +01:00
parent 998a780676
commit dd5214dc6e
2 changed files with 12 additions and 3 deletions

View File

@ -388,7 +388,7 @@ struct box_defs
"\n"
"@return A reference to this box.\n"
) +
method_ext ("moved", &box_defs<C>::moved, gsi::arg ("dx, 0"), gsi::arg ("dy", 0),
method_ext ("moved", &box_defs<C>::moved, gsi::arg ("dx", 0), gsi::arg ("dy", 0),
"@brief Moves the box by a certain distance\n"
"\n"
"This is a convenience method which takes two values instead of a Point object.\n"
@ -419,7 +419,7 @@ struct box_defs
"\n"
"@return The moved box.\n"
) +
method_ext ("enlarge", &box_defs<C>::enlarge, gsi::arg ("dx"), gsi::arg ("dy"),
method_ext ("enlarge", &box_defs<C>::enlarge, gsi::arg ("dx", 0), gsi::arg ("dy", 0),
"@brief Enlarges the box by a certain amount.\n"
"\n"
"\n"
@ -436,7 +436,7 @@ struct box_defs
"\n"
"@return A reference to this box.\n"
) +
method_ext ("enlarged", &box_defs<C>::enlarged, gsi::arg ("dx"), gsi::arg ("dy"),
method_ext ("enlarged", &box_defs<C>::enlarged, gsi::arg ("dx", 0), gsi::arg ("dy", 0),
"@brief Enlarges the box by a certain amount.\n"
"\n"
"\n"

View File

@ -271,6 +271,10 @@ class DBBox_TestClass < TestBase
assert_equal( a.to_s, "(-9,18;12,22)" )
a = b.moved( 1, -1 )
assert_equal( a.to_s, "(-9,16;12,20)" )
a = b.moved( dy: 1 )
assert_equal( a.to_s, "(-10,18;11,22)" )
a = b.moved( dx: 1 )
assert_equal( a.to_s, "(-9,17;12,21)" )
a = b.dup
a.move( 1, -1 )
@ -304,7 +308,12 @@ class DBBox_TestClass < TestBase
aa = a.dup
a.enlarge( -1, 1 )
assert_equal( a.to_s, "(-10,21;11,25)" )
a.enlarge( 1, -1 )
a.enlarge( dy: 1 )
a.enlarge( dx: -1 )
assert_equal( a.to_s, "(-10,21;11,25)" )
assert_equal( aa.enlarged( -1, 1 ).to_s, "(-10,21;11,25)" )
assert_equal( aa.enlarged( :dy => 1, :dx => -1 ).to_s, "(-10,21;11,25)" )
a = a.enlarged( RBA::Point::new(1, -1) )
assert_equal( a.to_s, "(-11,22;12,24)" )