[Libreoffice-commits] core.git: include/test include/unotest sw/qa test/source unotest/source vcl/qa
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 1 15:40:38 UTC 2021
include/test/bootstrapfixture.hxx | 3
include/unotest/bootstrapfixturebase.hxx | 2
sw/qa/extras/uiwriter/uiwriter3.cxx | 2
test/source/bootstrapfixture.cxx | 9 ++
unotest/source/cpp/bootstrapfixturebase.cxx | 13 ---
vcl/qa/cppunit/BackendTest.cxx | 90 +++++++++++------------
vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | 2
7 files changed, 60 insertions(+), 61 deletions(-)
New commits:
commit 6dfc7354d7100effa380ec7f6e368a2c0ec92232
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Apr 1 16:54:44 2021 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Apr 1 17:39:54 2021 +0200
Exclude tests based on device color depth, not RDP
After 5c9ba1f47d00ed10960b59928befd68f6c020b15, the failures on Jenkins
(see 21191d0d8953a3ca6eac6022c0a14a87fe9c5e2a) made it apparent that
(at least some of) Jenkins builds also run in RDP sessions. Since the
tests excluded in commit 9c6142ec26a0ba61b1cf58d1e6bf0b5376394bcd never
failed in Jenkins builds before, it is wrong to exclude all those tests
in all RDP sessions: our CI would not test those on Windows.
In the meanwhile, I discovered that the system that failed the tests
actually had 16-bit color depth, despite RDP being configured to use
32-bit colors; that was the reason why the colors were modified on
roundtrip. So it is better to test the actual problem to exclude tests.
This reimplements the check that was introduced in commit
9c6142ec26a0ba61b1cf58d1e6bf0b5376394bcd to test default virtual device
color depth.
Change-Id: I329a3e2d8eca21732c77dcacf15394d1246b2e18
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113460
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/include/test/bootstrapfixture.hxx b/include/test/bootstrapfixture.hxx
index 3a0cc1da7119..b039f0e6e3bf 100644
--- a/include/test/bootstrapfixture.hxx
+++ b/include/test/bootstrapfixture.hxx
@@ -63,6 +63,9 @@ public:
virtual void setUp() override;
void validate(const OUString& rURL, ValidationFormat) const;
+
+ // Allows to exclude tests dependent on color depth of the default virtual device
+ static sal_uInt16 getDefaultDeviceBitCount();
};
}
diff --git a/include/unotest/bootstrapfixturebase.hxx b/include/unotest/bootstrapfixturebase.hxx
index 11650df8c4d5..1a25e25d4ca0 100644
--- a/include/unotest/bootstrapfixturebase.hxx
+++ b/include/unotest/bootstrapfixturebase.hxx
@@ -65,8 +65,6 @@ public:
virtual void setUp() override;
virtual void tearDown() override;
-
- static bool isWindowsRDP();
};
}
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index f998e2313684..16cb96bf4186 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2622,7 +2622,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135661)
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133477)
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
load(DATA_DIRECTORY, "tdf133477.fodt");
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index 5116ac32115a..5ae9b3e4ab24 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -25,7 +25,9 @@
#include <osl/file.hxx>
#include <osl/process.h>
#include <unotools/tempfile.hxx>
+#include <vcl/salgtype.hxx>
#include <vcl/scheduler.hxx>
+#include <vcl/virdev.hxx>
#include <memory>
#include <cstring>
@@ -246,4 +248,11 @@ bool test::BootstrapFixture::IsDefaultDPI()
&& Application::GetDefaultDevice()->GetDPIY() == 96);
}
+sal_uInt16 test::BootstrapFixture::getDefaultDeviceBitCount()
+{
+ ScopedVclPtr<VirtualDevice> device
+ = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT);
+ return device->GetBitCount();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx
index a8affd272674..5c5b3bcc3a9c 100644
--- a/unotest/source/cpp/bootstrapfixturebase.cxx
+++ b/unotest/source/cpp/bootstrapfixturebase.cxx
@@ -13,10 +13,6 @@
#include <comphelper/processfactory.hxx>
#include <basic/sbstar.hxx>
-#if defined _WIN32
-#include <systools/win32/uwinapi.h>
-#endif
-
using namespace ::com::sun::star;
// NB. this constructor is called before any tests are run, once for each
@@ -36,13 +32,4 @@ void test::BootstrapFixtureBase::setUp()
void test::BootstrapFixtureBase::tearDown() { StarBASIC::DetachAllDocBasicItems(); }
-bool test::BootstrapFixtureBase::isWindowsRDP()
-{
-#if defined _WIN32
- return GetSystemMetrics(SM_REMOTESESSION) != 0;
-#else
- return false;
-#endif
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index bb3abce0f99c..43b7bc1b2e13 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -94,7 +94,7 @@ public:
void testDrawRectWithRectangle()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestRect aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(false);
@@ -107,7 +107,7 @@ public:
void testDrawRectWithPixel()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPixel aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(false);
@@ -120,7 +120,7 @@ public:
void testDrawRectWithLine()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestLine aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(false);
@@ -133,7 +133,7 @@ public:
void testDrawRectWithPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolygon aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(false);
@@ -145,7 +145,7 @@ public:
void testDrawRectWithPolyLine()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyLine aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(false);
@@ -157,7 +157,7 @@ public:
void testDrawRectWithPolyLineB2D()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(false);
@@ -169,7 +169,7 @@ public:
void testDrawRectWithPolyPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(false);
@@ -181,7 +181,7 @@ public:
void testDrawRectWithPolyPolygonB2D()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(false);
@@ -193,7 +193,7 @@ public:
void testDrawRectAAWithRectangle()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestRect aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(true);
@@ -205,7 +205,7 @@ public:
void testDrawRectAAWithPixel()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPixel aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(true);
@@ -217,7 +217,7 @@ public:
void testDrawRectAAWithLine()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestLine aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(true);
@@ -229,7 +229,7 @@ public:
void testDrawRectAAWithPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolygon aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(true);
@@ -241,7 +241,7 @@ public:
void testDrawRectAAWithPolyLine()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyLine aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(true);
@@ -253,7 +253,7 @@ public:
void testDrawRectAAWithPolyLineB2D()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(true);
@@ -265,7 +265,7 @@ public:
void testDrawRectAAWithPolyPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(true);
@@ -277,7 +277,7 @@ public:
void testDrawRectAAWithPolyPolygonB2D()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRectangle(true);
@@ -289,7 +289,7 @@ public:
void testDrawFilledRectWithRectangle()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestRect aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
@@ -306,7 +306,7 @@ public:
void testDrawFilledRectWithPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolygon aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
@@ -323,7 +323,7 @@ public:
void testDrawFilledRectWithPolyPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
@@ -340,7 +340,7 @@ public:
void testDrawFilledRectWithPolyPolygon2D()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
@@ -427,7 +427,7 @@ public:
void testDrawBezierWithPolylineB2D()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupBezier();
@@ -439,7 +439,7 @@ public:
void testDrawBezierAAWithPolylineB2D()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupAABezier();
@@ -451,7 +451,7 @@ public:
void testDrawBitmap()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestBitmap aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupDrawBitmap();
@@ -463,7 +463,7 @@ public:
void testDrawTransformedBitmap()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestBitmap aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupDrawTransformedBitmap();
@@ -475,7 +475,7 @@ public:
void testDrawBitmapExWithAlpha()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestBitmap aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupDrawBitmapExWithAlpha();
@@ -487,7 +487,7 @@ public:
void testDrawMask()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestBitmap aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupDrawMask();
@@ -499,7 +499,7 @@ public:
void testDrawBlend()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestBitmap aOutDevTest;
BitmapEx aBitmapEx = aOutDevTest.setupDrawBlend();
@@ -511,7 +511,7 @@ public:
void testDrawXor()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupXOR();
@@ -525,7 +525,7 @@ public:
{
// TODO: This unit test is not executed for macOS unless bitmap scaling is implemented
#ifndef MACOSX
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
ScopedVclPtrInstance<VirtualDevice> device;
device->SetOutputSizePixel(Size(16, 16));
@@ -563,7 +563,7 @@ public:
void testClipRectangle()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestClip aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupClipRectangle();
@@ -575,7 +575,7 @@ public:
void testClipPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestClip aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupClipPolygon();
@@ -587,7 +587,7 @@ public:
void testClipPolyPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestClip aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupClipPolyPolygon();
@@ -599,7 +599,7 @@ public:
void testClipB2DPolyPolygon()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestClip aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupClipB2DPolyPolygon();
@@ -611,7 +611,7 @@ public:
void testDrawOutDev()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupDrawOutDev();
@@ -623,7 +623,7 @@ public:
void testDashedLine()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestLine aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupDashedLine();
@@ -635,7 +635,7 @@ public:
void testErase()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
{
// Create normal virtual device (no alpha).
@@ -702,7 +702,7 @@ public:
void testLinearGradient()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestGradient aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupLinearGradient();
@@ -714,7 +714,7 @@ public:
void testLinearGradientAngled()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestGradient aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupLinearGradientAngled();
@@ -736,7 +736,7 @@ public:
void testLinearGradientIntensity()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestGradient aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupLinearGradientIntensity();
@@ -748,7 +748,7 @@ public:
void testLinearGradientSteps()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestGradient aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupLinearGradientSteps();
@@ -760,7 +760,7 @@ public:
void testAxialGradient()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestGradient aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupAxialGradient();
@@ -772,7 +772,7 @@ public:
void testRadialGradient()
{
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
vcl::test::OutputDeviceTestGradient aOutDevTest;
Bitmap aBitmap = aOutDevTest.setupRadialGradient();
@@ -797,7 +797,7 @@ public:
{
// TODO: This unit test is not executed for macOS unless bitmap scaling is implemented
#ifndef MACOSX
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
// Create virtual device with alpha.
ScopedVclPtr<VirtualDevice> device
@@ -851,6 +851,8 @@ public:
{
// TODO: This unit test is not executed for macOS unless bitmap scaling is implemented
#ifndef MACOSX
+ if (getDefaultDeviceBitCount() < 24)
+ return;
// Normal virtual device.
ScopedVclPtr<VirtualDevice> device = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT);
// Virtual device with alpha.
@@ -947,7 +949,7 @@ public:
{
// TODO: Following unit tests are not executed for macOS unless bitmap scaling is implemented
#ifndef MACOSX
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
// Create virtual device with alpha.
ScopedVclPtr<VirtualDevice> device
diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
index 323c40e11ebf..5da8cb643849 100644
--- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
+++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
@@ -126,7 +126,7 @@ void BitmapRenderTest::testDrawAlphaBitmapEx()
{
// TODO: This unit test is not executed for macOS unless bitmap scaling is implemented
#ifndef MACOSX
- if (isWindowsRDP())
+ if (getDefaultDeviceBitCount() < 24)
return;
ScopedVclPtrInstance<VirtualDevice> pVDev;
pVDev->SetOutputSizePixel(Size(8, 8));
More information about the Libreoffice-commits
mailing list