Kaydet (Commit) 43691a15 authored tarafından Noel Grandin's avatar Noel Grandin

tdf#93794 - spin buttons not rendered in gtk2/gtk3

for penance, introduce a unit test

Change-Id: I2c40285732be665e179c477e6e7603aa6f8be5d7
üst 489dbb31
......@@ -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".
......
......@@ -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());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment