include/tools/gen.hxx | 4 ++-- tools/qa/cppunit/test_rectangle.cxx | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-)
New commits: commit 43691a15b332193341884e0bb40d24601fe123fe Author: Noel Grandin <n...@peralex.com> Date: Mon Aug 31 13:59:21 2015 +0200 tdf#93794 - spin buttons not rendered in gtk2/gtk3 for penance, introduce a unit test Change-Id: I2c40285732be665e179c477e6e7603aa6f8be5d7 diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 74e97ba..7a98f0a 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -368,9 +368,9 @@ public: /// Returns the difference between bottom and top, assuming the range includes one end, but not the other. long getHeight() const { return nBottom - nTop; } /// Set the left edge of the rectangle to x, preserving the width - void setX( long x ) { nLeft = x; nRight += x - nLeft; } + void setX( long x ) { nRight += x - nLeft; nLeft = x; } /// Set the top edge of the rectangle to y, preserving the height - void setY( long y ) { nTop = y; nBottom += y - nTop; } + void setY( long y ) { nBottom += y - nTop; nTop = y; } void setWidth( long n ) { nRight = nLeft + n; } void setHeight( long n ) { nBottom = nTop + n; } /// Returns the string representation of the rectangle, format is "x, y, width, height". diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx index 29d04c8..4f3fff8 100644 --- a/tools/qa/cppunit/test_rectangle.cxx +++ b/tools/qa/cppunit/test_rectangle.cxx @@ -49,6 +49,11 @@ void Test::test_rectangle() CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth()); CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight()); + + aRect.setX(12); + CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight()); + aRect.setY(12); + CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth()); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits