summaryrefslogtreecommitdiff
path: root/vcl/backendtest/outputdevice/polyline_b2d.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-04-15 21:52:46 +0900
committerTomaž Vajngerl <quikee@gmail.com>2019-04-16 03:48:28 +0200
commit3083fe569f96bf0289da1e9d0ef7da15ab22e2f6 (patch)
tree7009b2023d374e15d718cc2bd30b98295dc78263 /vcl/backendtest/outputdevice/polyline_b2d.cxx
parent25a28cee10736e8a72b40b5ab2d11dea8d5254c3 (diff)
Add backend tests as CPPUNIT tests
This (finally) adds backend tests as CPPUNIT tests too. In the future they'll also be added into LibreOffice directly as a way to test if the backend is OK, which will be useful especially for the OpenGL backend, which draw quality depends on the driver. Currently all the tests are ignored because of the bugs in the backend, which need to be addressed first and tests then can be enabled one by one. The main reason for the test is to identify issues when drawing is done at a wrong position, which is a very common problem. Also other types of tests will be added in time, which will have a big role in the refactoring of VCL that will happen in the future. Change-Id: I92237d47d49fa0db01b73b8bc39f7a621b65961e Reviewed-on: https://gerrit.libreoffice.org/70769 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/backendtest/outputdevice/polyline_b2d.cxx')
-rw-r--r--vcl/backendtest/outputdevice/polyline_b2d.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/vcl/backendtest/outputdevice/polyline_b2d.cxx b/vcl/backendtest/outputdevice/polyline_b2d.cxx
new file mode 100644
index 000000000000..d6b9886b41ee
--- /dev/null
+++ b/vcl/backendtest/outputdevice/polyline_b2d.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <test/outputdevice.hxx>
+
+namespace vcl
+{
+namespace test
+{
+namespace
+{
+void drawPolyLineOffset(OutputDevice& rDevice, tools::Rectangle const& rRect, int nOffset)
+{
+ basegfx::B2DPolygon aPolygon{
+ basegfx::B2DPoint(rRect.Left() + nOffset, rRect.Top() + nOffset),
+ basegfx::B2DPoint(rRect.Right() - nOffset, rRect.Top() + nOffset),
+ basegfx::B2DPoint(rRect.Right() - nOffset, rRect.Bottom() - nOffset),
+ basegfx::B2DPoint(rRect.Left() + nOffset, rRect.Bottom() - nOffset),
+ };
+ aPolygon.setClosed(true);
+
+ rDevice.DrawPolyLine(aPolygon, 0.0); // draw hairline
+}
+
+} // end anonymous namespace
+
+Bitmap OutputDeviceTestPolyLineB2D::setupRectangle(bool bEnableAA)
+{
+ initialSetup(13, 13, constBackgroundColor, bEnableAA);
+
+ mpVirtualDevice->SetLineColor(constLineColor);
+ mpVirtualDevice->SetFillColor();
+
+ drawPolyLineOffset(*mpVirtualDevice, maVDRectangle, 2);
+ drawPolyLineOffset(*mpVirtualDevice, maVDRectangle, 5);
+
+ return mpVirtualDevice->GetBitmapEx(maVDRectangle.TopLeft(), maVDRectangle.GetSize())
+ .GetBitmap();
+}
+}
+} // end namespace vcl::test
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */