summaryrefslogtreecommitdiffstats
path: root/basegfx/test
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-05-09 09:18:00 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-05-09 10:46:55 +0200
commitf8b4d371eddd27594d549fb00294c01229a9bd24 (patch)
tree424a678ec749aca0431ef09d3eafff54d8c3eb13 /basegfx/test
parentQt5 IM handle (spurious?) all-empty IM events (diff)
downloadcore-f8b4d371eddd27594d549fb00294c01229a9bd24.tar.gz
core-f8b4d371eddd27594d549fb00294c01229a9bd24.zip
drawinglayer: avoid AA for hairline polygons built from hori/vert lines only
For one, it seems this was the intention already since commit 85c70f37b56299f6fa02312c0fb73cc55af084ef (CWS-TOOLING: integrate CWS aw063, 2009-03-04): "suppress AntiAliasing for pure horizontal or vertical lines". For another, this fixes the TileCacheTests::testTileWireIDHandling() testcase in online.git, which assumes that the indicators at the corners of the Writer body frame (paragraph marks hidden / default case) can be painted multiple times, producing pixel-by-pixel matching results. But in reality AA breaks that assumption, and we know these indicators are never diagonal lines. Change-Id: Ib74f823165799991296b64cee58ec106dbdcedcf Reviewed-on: https://gerrit.libreoffice.org/72000 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'basegfx/test')
-rw-r--r--basegfx/test/B2DPolygonTest.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/basegfx/test/B2DPolygonTest.cxx b/basegfx/test/B2DPolygonTest.cxx
index 9f0d1ef98dcc..316a916f931f 100644
--- a/basegfx/test/B2DPolygonTest.cxx
+++ b/basegfx/test/B2DPolygonTest.cxx
@@ -22,6 +22,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/point/b2dpoint.hxx>
namespace basegfx
@@ -77,12 +78,31 @@ public:
CPPUNIT_ASSERT_EQUAL_MESSAGE("#2 second polygon point wrong", B2DPoint(3, 3),
aPoly.getB2DPoint(1));
}
+
+ void testContainsOnlyHorizontalOrVerticalLines()
+ {
+ // First line is horziontal, second is vertical.
+ B2DPolygon aPoly;
+ aPoly.append(B2DPoint(0, 1));
+ aPoly.append(B2DPoint(1, 1));
+ aPoly.append(B2DPoint(1, 0));
+ CPPUNIT_ASSERT(utils::containsOnlyHorizontalOrVerticalLines(aPoly));
+
+ // First line is diagonal, second is vertical.
+ aPoly.clear();
+ aPoly.append(B2DPoint(0, 0));
+ aPoly.append(B2DPoint(1, 1));
+ aPoly.append(B2DPoint(1, 0));
+ CPPUNIT_ASSERT(!utils::containsOnlyHorizontalOrVerticalLines(aPoly));
+ }
+
// Change the following lines only, if you add, remove or rename
// member functions of the current class,
// because these macros are need by auto register mechanism.
CPPUNIT_TEST_SUITE(b2dpolygon);
CPPUNIT_TEST(testBasics);
+ CPPUNIT_TEST(testContainsOnlyHorizontalOrVerticalLines);
CPPUNIT_TEST_SUITE_END();
}; // class b2dpolygon