[Libreoffice-commits] core.git: vcl/backendtest vcl/qa
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 16 09:56:30 UTC 2020
vcl/backendtest/VisualBackendTest.cxx | 98 +++++++++++++++++++++++++++-------
vcl/qa/cppunit/BackendTest.cxx | 16 +++++
2 files changed, 93 insertions(+), 21 deletions(-)
New commits:
commit b0ac1fc0e434df76c44f283508e6da8ef7f61278
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Jul 14 13:01:57 2020 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Jul 16 11:55:40 2020 +0200
sync visualbackendtest and vcl_backend_test
Change-Id: Id3471e2812f2b710d71e748e3542bc8c49dbb7a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98720
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx
index 08efc1d381a3..b3e1b3eb144c 100644
--- a/vcl/backendtest/VisualBackendTest.cxx
+++ b/vcl/backendtest/VisualBackendTest.cxx
@@ -90,7 +90,7 @@ class VisualBackendTestWindow : public WorkWindow
private:
Timer maUpdateTimer;
std::vector<std::chrono::high_resolution_clock::time_point> mTimePoints;
- static constexpr unsigned char gnNumberOfTests = 9;
+ static constexpr unsigned char gnNumberOfTests = 10;
unsigned char mnTest;
bool mbAnimate;
ScopedVclPtr<VirtualDevice> mpVDev;
@@ -155,23 +155,23 @@ public:
long x2 = (x+1) * (nWidth / nPartitionsX);
long y2 = (y+1) * (nHeight / nPartitionsY);
- aRegions.emplace_back(x1 + 1, y1 + 1, x2 - 2, y2 - 2);
+ aRegions.emplace_back(x1 + 1, y1 + 1, x2 - 6, y2 - 2);
}
}
return aRegions;
}
- static void testRectangles(vcl::RenderContext& rRenderContext, int nWidth, int nHeight)
+ static void testRectangles(vcl::RenderContext& rRenderContext, int nWidth, int nHeight, bool AA)
{
tools::Rectangle aRectangle;
size_t index = 0;
- std::vector<tools::Rectangle> aRegions = setupRegions(3, 2, nWidth, nHeight);
+ std::vector<tools::Rectangle> aRegions = setupRegions(4, 2, nWidth, nHeight);
aRectangle = aRegions[index++];
{
vcl::test::OutputDeviceTestRect aOutDevTest;
- Bitmap aBitmap = aOutDevTest.setupRectangle(false);
+ Bitmap aBitmap = aOutDevTest.setupRectangle(AA);
assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext);
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
@@ -179,7 +179,7 @@ public:
aRectangle = aRegions[index++];
{
vcl::test::OutputDeviceTestPixel aOutDevTest;
- Bitmap aBitmap = aOutDevTest.setupRectangle(false);
+ Bitmap aBitmap = aOutDevTest.setupRectangle(AA);
assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext);
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
@@ -187,7 +187,7 @@ public:
aRectangle = aRegions[index++];
{
vcl::test::OutputDeviceTestLine aOutDevTest;
- Bitmap aBitmap = aOutDevTest.setupRectangle(false);
+ Bitmap aBitmap = aOutDevTest.setupRectangle(AA);
assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext);
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
@@ -195,7 +195,7 @@ public:
aRectangle = aRegions[index++];
{
vcl::test::OutputDeviceTestPolygon aOutDevTest;
- Bitmap aBitmap = aOutDevTest.setupRectangle(false);
+ Bitmap aBitmap = aOutDevTest.setupRectangle(AA);
assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext);
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
@@ -203,7 +203,15 @@ public:
aRectangle = aRegions[index++];
{
vcl::test::OutputDeviceTestPolyLine aOutDevTest;
- Bitmap aBitmap = aOutDevTest.setupRectangle(false);
+ Bitmap aBitmap = aOutDevTest.setupRectangle(AA);
+ assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext);
+ drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
+ }
+
+ aRectangle = aRegions[index++];
+ {
+ vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
+ Bitmap aBitmap = aOutDevTest.setupRectangle(AA);
assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext);
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
@@ -211,7 +219,15 @@ public:
aRectangle = aRegions[index++];
{
vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
- Bitmap aBitmap = aOutDevTest.setupRectangle(false);
+ Bitmap aBitmap = aOutDevTest.setupRectangle(AA);
+ assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext);
+ drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
+ }
+
+ aRectangle = aRegions[index++];
+ {
+ vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
+ Bitmap aBitmap = aOutDevTest.setupRectangle(AA);
assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap), aRectangle, rRenderContext);
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
@@ -222,7 +238,7 @@ public:
tools::Rectangle aRectangle;
size_t index = 0;
- std::vector<tools::Rectangle> aRegions = setupRegions(3, 2, nWidth, nHeight);
+ std::vector<tools::Rectangle> aRegions = setupRegions(4, 2, nWidth, nHeight);
aRectangle = aRegions[index++];
{
@@ -248,6 +264,14 @@ public:
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
+ aRectangle = aRegions[index++];
+ {
+ vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
+ Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
+ assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false), aRectangle, rRenderContext);
+ drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
+ }
+
aRectangle = aRegions[index++];
{
vcl::test::OutputDeviceTestRect aOutDevTest;
@@ -271,14 +295,22 @@ public:
assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true), aRectangle, rRenderContext);
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
+
+ aRectangle = aRegions[index++];
+ {
+ vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
+ Bitmap aBitmap = aOutDevTest.setupFilledRectangle(true);
+ assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, true), aRectangle, rRenderContext);
+ drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
+ }
}
- static void testDiamonds(vcl::RenderContext& rRenderContext, int nWidth, int nHeight)
+ static void testDiamondsAndBezier(vcl::RenderContext& rRenderContext, int nWidth, int nHeight)
{
tools::Rectangle aRectangle;
size_t index = 0;
- std::vector<tools::Rectangle> aRegions = setupRegions(3, 1, nWidth, nHeight);
+ std::vector<tools::Rectangle> aRegions = setupRegions(3, 2, nWidth, nHeight);
aRectangle = aRegions[index++];
{
@@ -301,6 +333,28 @@ public:
assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap), aRectangle, rRenderContext);
drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
}
+ aRectangle = aRegions[index++];
+ {
+ vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
+ Bitmap aBitmap = aOutDevTest.setupDiamond();
+ assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkDiamond(aBitmap), aRectangle, rRenderContext);
+ drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
+ }
+
+ aRectangle = aRegions[index++];
+ {
+ vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
+ Bitmap aBitmap = aOutDevTest.setupBezier();
+ assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap), aRectangle, rRenderContext);
+ drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
+ }
+ aRectangle = aRegions[index++];
+ {
+ vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
+ Bitmap aBitmap = aOutDevTest.setupAABezier();
+ assertAndSetBackground(vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap), aRectangle, rRenderContext);
+ drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
+ }
}
static void testLines(vcl::RenderContext& rRenderContext, int nWidth, int nHeight)
@@ -548,33 +602,37 @@ public:
if (mnTest % gnNumberOfTests == 0)
{
- testRectangles(rRenderContext, nWidth, nHeight);
+ testRectangles(rRenderContext, nWidth, nHeight, false);
}
else if (mnTest % gnNumberOfTests == 1)
{
- testFilledRectangles(rRenderContext, nWidth, nHeight);
+ testRectangles(rRenderContext, nWidth, nHeight, true);
}
else if (mnTest % gnNumberOfTests == 2)
{
- testDiamonds(rRenderContext, nWidth, nHeight);
+ testFilledRectangles(rRenderContext, nWidth, nHeight);
}
else if (mnTest % gnNumberOfTests == 3)
{
- testLines(rRenderContext, nWidth, nHeight);
+ testDiamondsAndBezier(rRenderContext, nWidth, nHeight);
}
else if (mnTest % gnNumberOfTests == 4)
{
- testBitmaps(rRenderContext, nWidth, nHeight);
+ testLines(rRenderContext, nWidth, nHeight);
}
else if (mnTest % gnNumberOfTests == 5)
{
- testInvert(rRenderContext, nWidth, nHeight);
+ testBitmaps(rRenderContext, nWidth, nHeight);
}
else if (mnTest % gnNumberOfTests == 6)
{
- testClip(rRenderContext, nWidth, nHeight);
+ testInvert(rRenderContext, nWidth, nHeight);
}
else if (mnTest % gnNumberOfTests == 7)
+ {
+ testClip(rRenderContext, nWidth, nHeight);
+ }
+ else if (mnTest % gnNumberOfTests == 8)
{
std::vector<tools::Rectangle> aRegions = setupRegions(2, 2, nWidth, nHeight);
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index ff4ed0d87251..68ddebb4380b 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -495,16 +495,28 @@ public:
CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
}
+ void testDrawOutDev()
+ {
+ vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
+ Bitmap aBitmap = aOutDevTest.setupDrawOutDev();
+ auto eResult = vcl::test::OutputDeviceTestAnotherOutDev::checkDrawOutDev(aBitmap);
+ exportImage("10-01_draw_out_dev_test.png", aBitmap);
+ if (SHOULD_ASSERT)
+ CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
+ }
+
void testDashedLine()
{
vcl::test::OutputDeviceTestLine aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupDashedLine();
auto eResult = vcl::test::OutputDeviceTestLine::checkDashedLine(aBitmap);
- exportImage("10-01_dashed_line_test.png", aBitmap);
+ exportImage("11-01_dashed_line_test.png", aBitmap);
if (SHOULD_ASSERT)
CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
}
+ // vcl::test::OutputDeviceTestGradient does not verify anything, cannot test here
+
void testTdf124848()
{
ScopedVclPtr<VirtualDevice> device = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT);
@@ -585,6 +597,8 @@ public:
CPPUNIT_TEST(testClipPolyPolygon);
CPPUNIT_TEST(testClipB2DPolyPolygon);
+ CPPUNIT_TEST(testDrawOutDev);
+
CPPUNIT_TEST(testDashedLine);
CPPUNIT_TEST(testTdf124848);
More information about the Libreoffice-commits
mailing list