summaryrefslogtreecommitdiffstats
path: root/svx/qa/unit/svdraw.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/qa/unit/svdraw.cxx')
-rw-r--r--svx/qa/unit/svdraw.cxx68
1 files changed, 67 insertions, 1 deletions
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 3f91084d6483..b2128ac75c93 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -7,7 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <test/unoapixml_test.hxx>
+#include <basegfx/units/Length.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -38,6 +38,8 @@
#include <sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <test/unoapixml_test.hxx>
+
using namespace ::com::sun::star;
namespace
@@ -711,6 +713,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRotatePoint)
}
}
+<<<<<<< HEAD
CPPUNIT_TEST_FIXTURE(SvdrawTest, testClipVerticalTextOverflow)
{
// File contains a slide with 4 rectangle shapes with text inside
@@ -754,6 +757,69 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testClipVerticalTextOverflow)
assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[1]"_ostr, "x"_ostr, "25417");
assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[3]"_ostr, "x"_ostr, "23893");
}
+
+CPPUNIT_TEST_FIXTURE(SvdrawTest, testResizeRect)
+{
+ {
+ tools::Rectangle aRectangle(1, 1, 10, 10);
+ Point aReference(1, 1);
+ ResizeRect(aRectangle, aReference, Fraction(1, 2), Fraction(1, 2));
+
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(1, 1, 6, 6), aRectangle);
+ }
+
+ {
+ tools::Rectangle aRectangle(1, 1, 10, 10);
+ Point aReference(10, 10);
+ ResizeRect(aRectangle, aReference, Fraction(1, 2), Fraction(1, 2));
+
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(5, 5, 10, 10), aRectangle);
+ }
+
+ {
+ gfx::Range2DLWrap aRange(1_hmm, 1_hmm, 10_hmm, 10_hmm);
+ CPPUNIT_ASSERT_EQUAL(9_hmm, aRange.getWidth());
+ CPPUNIT_ASSERT_EQUAL(9_hmm, aRange.getHeight());
+
+ gfx::Tuple2DL aReference(1_hmm, 1_hmm);
+ svx::resizeRange(aRange, aReference, 0.5, 0.5);
+
+ CPPUNIT_ASSERT_EQUAL(false, aRange.isEmpty());
+
+ CPPUNIT_ASSERT_EQUAL(1_hmm, aRange.getMinX());
+ CPPUNIT_ASSERT_EQUAL(5.5_hmm, aRange.getMaxX());
+ CPPUNIT_ASSERT_EQUAL(1_hmm, aRange.getMinY());
+ CPPUNIT_ASSERT_EQUAL(5.5_hmm, aRange.getMaxY());
+
+ CPPUNIT_ASSERT_EQUAL(4.5_hmm, aRange.getWidth());
+ CPPUNIT_ASSERT_EQUAL(4.5_hmm, aRange.getHeight());
+
+ auto aRectangle = aRange.toToolsRect();
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(1, 1, 6, 6), aRectangle);
+ }
+
+ {
+ gfx::Range2DLWrap aRange(1_hmm, 1_hmm, 10_hmm, 10_hmm);
+ CPPUNIT_ASSERT_EQUAL(9_hmm, aRange.getWidth());
+ CPPUNIT_ASSERT_EQUAL(9_hmm, aRange.getHeight());
+
+ gfx::Tuple2DL aReference(10_hmm, 10_hmm);
+ svx::resizeRange(aRange, aReference, 0.5, 0.5);
+
+ CPPUNIT_ASSERT_EQUAL(false, aRange.isEmpty());
+
+ CPPUNIT_ASSERT_EQUAL(5.5_hmm, aRange.getMinX());
+ CPPUNIT_ASSERT_EQUAL(10_hmm, aRange.getMaxX());
+ CPPUNIT_ASSERT_EQUAL(5.5_hmm, aRange.getMinY());
+ CPPUNIT_ASSERT_EQUAL(10_hmm, aRange.getMaxY());
+
+ CPPUNIT_ASSERT_EQUAL(4.5_hmm, aRange.getWidth());
+ CPPUNIT_ASSERT_EQUAL(4.5_hmm, aRange.getHeight());
+
+ auto aRectangle = aRange.toToolsRect();
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(6, 6, 10, 10), aRectangle);
+ }
+}
} // end anonymous namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */