[Libreoffice-commits] core.git: include/unotest sw/qa unotest/source vcl/qa

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 30 21:01:25 UTC 2021


 include/unotest/bootstrapfixturebase.hxx         |    1 
 sw/qa/extras/uiwriter/uiwriter3.cxx              |    2 
 unotest/source/cpp/bootstrapfixturebase.cxx      |   13 +++
 vcl/qa/cppunit/BackendTest.cxx                   |   88 +++++++++++++++++++++++
 vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx |    2 
 5 files changed, 106 insertions(+)

New commits:
commit 9c6142ec26a0ba61b1cf58d1e6bf0b5376394bcd
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Mar 30 18:36:08 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Mar 30 23:00:37 2021 +0200

    Exclude some tests in Windows RDP session
    
    It seems that RDP may change (limit?) color space (even configured
    to use 32-bit colors), and then some tests start failing like this:
    
      Test name: BackendTest::testDrawAlphaBitmapMirrored
      equality assertion failed
      - Expected: c[80000000]
      - Actual  : c[84000000]
    
    Debugging ImplDrawBitmap in vcl/win/gdi/gdiimpl.cxx, and adding a
    call to GetPixel immediately after the call to StretchDIBits, shows
    that the resulting color on the device is different from the color
    in the bitmap data: e.g., for original color {128, 0, 0} the result
    is {132, 0, 0}.
    
    Calling GetColorAdjustment shows that there's no color adjustments
    set for the device, so I can't detect or modify the behavior this
    way. So just disable the tests for now when running in RDP sessions.
    
    Change-Id: Ie89d07f18f53e56bed6f7fa58432b8575b4d9f12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113388
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/include/unotest/bootstrapfixturebase.hxx b/include/unotest/bootstrapfixturebase.hxx
index 85f270b02c2c..ac0e1166f8a6 100644
--- a/include/unotest/bootstrapfixturebase.hxx
+++ b/include/unotest/bootstrapfixturebase.hxx
@@ -66,6 +66,7 @@ public:
   virtual void setUp() override;
   virtual void tearDown() override;
 
+  bool isWindowsRDP() const;
 };
 
 }
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 944cb3b3f33b..f998e2313684 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2622,6 +2622,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135661)
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133477)
 {
+    if (isWindowsRDP())
+        return;
     load(DATA_DIRECTORY, "tdf133477.fodt");
     SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx
index 5c5b3bcc3a9c..5eb5b91dcaf0 100644
--- a/unotest/source/cpp/bootstrapfixturebase.cxx
+++ b/unotest/source/cpp/bootstrapfixturebase.cxx
@@ -13,6 +13,10 @@
 #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
@@ -32,4 +36,13 @@ void test::BootstrapFixtureBase::setUp()
 
 void test::BootstrapFixtureBase::tearDown() { StarBASIC::DetachAllDocBasicItems(); }
 
+bool test::BootstrapFixtureBase::isWindowsRDP() const
+{
+#if defined _WIN32
+    return GetSystemMetrics(SM_REMOTESESSION);
+#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 2f05ac47aea8..bb3abce0f99c 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -94,6 +94,8 @@ public:
 
     void testDrawRectWithRectangle()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestRect aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -105,6 +107,8 @@ public:
 
     void testDrawRectWithPixel()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPixel aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -116,6 +120,8 @@ public:
 
     void testDrawRectWithLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -127,6 +133,8 @@ public:
 
     void testDrawRectWithPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -137,6 +145,8 @@ public:
 
     void testDrawRectWithPolyLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -147,6 +157,8 @@ public:
 
     void testDrawRectWithPolyLineB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -157,6 +169,8 @@ public:
 
     void testDrawRectWithPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -167,6 +181,8 @@ public:
 
     void testDrawRectWithPolyPolygonB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -177,6 +193,8 @@ public:
 
     void testDrawRectAAWithRectangle()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestRect aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -187,6 +205,8 @@ public:
 
     void testDrawRectAAWithPixel()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPixel aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -197,6 +217,8 @@ public:
 
     void testDrawRectAAWithLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -207,6 +229,8 @@ public:
 
     void testDrawRectAAWithPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -217,6 +241,8 @@ public:
 
     void testDrawRectAAWithPolyLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -227,6 +253,8 @@ public:
 
     void testDrawRectAAWithPolyLineB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -237,6 +265,8 @@ public:
 
     void testDrawRectAAWithPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -247,6 +277,8 @@ public:
 
     void testDrawRectAAWithPolyPolygonB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -257,6 +289,8 @@ public:
 
     void testDrawFilledRectWithRectangle()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestRect aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false);
@@ -272,6 +306,8 @@ public:
 
     void testDrawFilledRectWithPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false);
@@ -287,6 +323,8 @@ public:
 
     void testDrawFilledRectWithPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false);
@@ -302,6 +340,8 @@ public:
 
     void testDrawFilledRectWithPolyPolygon2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false);
@@ -387,6 +427,8 @@ public:
 
     void testDrawBezierWithPolylineB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupBezier();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap);
@@ -397,6 +439,8 @@ public:
 
     void testDrawBezierAAWithPolylineB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupAABezier();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap);
@@ -407,6 +451,8 @@ public:
 
     void testDrawBitmap()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawBitmap();
         exportImage("08-01_bitmap_test.png", aBitmap);
@@ -417,6 +463,8 @@ public:
 
     void testDrawTransformedBitmap()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawTransformedBitmap();
         auto eResult = vcl::test::OutputDeviceTestBitmap::checkTransformedBitmap(aBitmap);
@@ -427,6 +475,8 @@ public:
 
     void testDrawBitmapExWithAlpha()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawBitmapExWithAlpha();
         auto eResult = vcl::test::OutputDeviceTestBitmap::checkBitmapExWithAlpha(aBitmap);
@@ -437,6 +487,8 @@ public:
 
     void testDrawMask()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawMask();
         auto eResult = vcl::test::OutputDeviceTestBitmap::checkMask(aBitmap);
@@ -447,6 +499,8 @@ public:
 
     void testDrawBlend()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         BitmapEx aBitmapEx = aOutDevTest.setupDrawBlend();
         auto eResult = vcl::test::OutputDeviceTestBitmap::checkBlend(aBitmapEx);
@@ -457,6 +511,8 @@ public:
 
     void testDrawXor()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupXOR();
         auto eResult = vcl::test::OutputDeviceTestAnotherOutDev::checkXOR(aBitmap);
@@ -469,6 +525,8 @@ public:
     {
 // TODO: This unit test is not executed for macOS unless bitmap scaling is implemented
 #ifndef MACOSX
+        if (isWindowsRDP())
+            return;
         ScopedVclPtrInstance<VirtualDevice> device;
         device->SetOutputSizePixel(Size(16, 16));
         device->SetBackground(Wallpaper(COL_WHITE));
@@ -505,6 +563,8 @@ public:
 
     void testClipRectangle()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestClip aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupClipRectangle();
         auto eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap);
@@ -515,6 +575,8 @@ public:
 
     void testClipPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestClip aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupClipPolygon();
         auto eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap);
@@ -525,6 +587,8 @@ public:
 
     void testClipPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestClip aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupClipPolyPolygon();
         auto eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap);
@@ -535,6 +599,8 @@ public:
 
     void testClipB2DPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestClip aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupClipB2DPolyPolygon();
         auto eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap);
@@ -545,6 +611,8 @@ public:
 
     void testDrawOutDev()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawOutDev();
         auto eResult = vcl::test::OutputDeviceTestAnotherOutDev::checkDrawOutDev(aBitmap);
@@ -555,6 +623,8 @@ public:
 
     void testDashedLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDashedLine();
         auto eResult = vcl::test::OutputDeviceTestLine::checkDashedLine(aBitmap);
@@ -565,6 +635,8 @@ public:
 
     void testErase()
     {
+        if (isWindowsRDP())
+            return;
         {
             // Create normal virtual device (no alpha).
             ScopedVclPtr<VirtualDevice> device
@@ -630,6 +702,8 @@ public:
 
     void testLinearGradient()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupLinearGradient();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradient(aBitmap);
@@ -640,6 +714,8 @@ public:
 
     void testLinearGradientAngled()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupLinearGradientAngled();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientAngled(aBitmap);
@@ -660,6 +736,8 @@ public:
 
     void testLinearGradientIntensity()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupLinearGradientIntensity();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientIntensity(aBitmap);
@@ -670,6 +748,8 @@ public:
 
     void testLinearGradientSteps()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupLinearGradientSteps();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientSteps(aBitmap);
@@ -680,6 +760,8 @@ public:
 
     void testAxialGradient()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupAxialGradient();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkAxialGradient(aBitmap);
@@ -690,6 +772,8 @@ public:
 
     void testRadialGradient()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRadialGradient();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkRadialGradient(aBitmap);
@@ -713,6 +797,8 @@ public:
     {
 // TODO: This unit test is not executed for macOS unless bitmap scaling is implemented
 #ifndef MACOSX
+        if (isWindowsRDP())
+            return;
         // Create virtual device with alpha.
         ScopedVclPtr<VirtualDevice> device
             = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT, DeviceFormat::DEFAULT);
@@ -861,6 +947,8 @@ public:
     {
 // TODO: Following unit tests are not executed for macOS unless bitmap scaling is implemented
 #ifndef MACOSX
+        if (isWindowsRDP())
+            return;
         // Create virtual device with alpha.
         ScopedVclPtr<VirtualDevice> device
             = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT, DeviceFormat::DEFAULT);
diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
index a0303833bacd..323c40e11ebf 100644
--- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
+++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
@@ -126,6 +126,8 @@ void BitmapRenderTest::testDrawAlphaBitmapEx()
 {
 // TODO: This unit test is not executed for macOS unless bitmap scaling is implemented
 #ifndef MACOSX
+    if (isWindowsRDP())
+        return;
     ScopedVclPtrInstance<VirtualDevice> pVDev;
     pVDev->SetOutputSizePixel(Size(8, 8));
     pVDev->SetBackground(Wallpaper(COL_WHITE));


More information about the Libreoffice-commits mailing list