[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - include/unotest sw/qa unotest/source vcl/qa

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 31 12:56:20 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 dd473f1d82f2533530534e22072a9cb976b01a4d
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Mar 30 18:36:08 2021 +0300
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 31 14:55:46 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>
    (cherry picked from commit 9c6142ec26a0ba61b1cf58d1e6bf0b5376394bcd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113355
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 95b51c5792a8d71b079eac42d6439abaa15e44e8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113403
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

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 e0623c817a91..f0444d3f3c7a 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2099,6 +2099,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 29d7268445e1..0f34dc65ecc1 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -95,6 +95,8 @@ public:
 
     void testDrawRectWithRectangle()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestRect aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -106,6 +108,8 @@ public:
 
     void testDrawRectWithPixel()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPixel aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -117,6 +121,8 @@ public:
 
     void testDrawRectWithLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -128,6 +134,8 @@ public:
 
     void testDrawRectWithPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -138,6 +146,8 @@ public:
 
     void testDrawRectWithPolyLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -148,6 +158,8 @@ public:
 
     void testDrawRectWithPolyLineB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -158,6 +170,8 @@ public:
 
     void testDrawRectWithPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -168,6 +182,8 @@ public:
 
     void testDrawRectWithPolyPolygonB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangle(aBitmap);
@@ -178,6 +194,8 @@ public:
 
     void testDrawRectAAWithRectangle()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestRect aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -188,6 +206,8 @@ public:
 
     void testDrawRectAAWithPixel()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPixel aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -198,6 +218,8 @@ public:
 
     void testDrawRectAAWithLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -208,6 +230,8 @@ public:
 
     void testDrawRectAAWithPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -218,6 +242,8 @@ public:
 
     void testDrawRectAAWithPolyLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -228,6 +254,8 @@ public:
 
     void testDrawRectAAWithPolyLineB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -238,6 +266,8 @@ public:
 
     void testDrawRectAAWithPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -248,6 +278,8 @@ public:
 
     void testDrawRectAAWithPolyPolygonB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRectangle(true);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkRectangleAA(aBitmap);
@@ -258,6 +290,8 @@ public:
 
     void testDrawFilledRectWithRectangle()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestRect aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false);
@@ -273,6 +307,8 @@ public:
 
     void testDrawFilledRectWithPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false);
@@ -288,6 +324,8 @@ public:
 
     void testDrawFilledRectWithPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygon aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false);
@@ -303,6 +341,8 @@ public:
 
     void testDrawFilledRectWithPolyPolygon2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyPolygonB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupFilledRectangle(false);
         auto eResult = vcl::test::OutputDeviceTestCommon::checkFilledRectangle(aBitmap, false);
@@ -388,6 +428,8 @@ public:
 
     void testDrawBezierWithPolylineB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupBezier();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap);
@@ -398,6 +440,8 @@ public:
 
     void testDrawBezierAAWithPolylineB2D()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestPolyLineB2D aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupAABezier();
         auto eResult = vcl::test::OutputDeviceTestCommon::checkBezier(aBitmap);
@@ -408,6 +452,8 @@ public:
 
     void testDrawBitmap()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawBitmap();
         exportImage("08-01_bitmap_test.png", aBitmap);
@@ -418,6 +464,8 @@ public:
 
     void testDrawTransformedBitmap()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawTransformedBitmap();
         auto eResult = vcl::test::OutputDeviceTestBitmap::checkTransformedBitmap(aBitmap);
@@ -428,6 +476,8 @@ public:
 
     void testDrawBitmapExWithAlpha()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawBitmapExWithAlpha();
         auto eResult = vcl::test::OutputDeviceTestBitmap::checkBitmapExWithAlpha(aBitmap);
@@ -438,6 +488,8 @@ public:
 
     void testDrawMask()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawMask();
         auto eResult = vcl::test::OutputDeviceTestBitmap::checkMask(aBitmap);
@@ -448,6 +500,8 @@ public:
 
     void testDrawBlend()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestBitmap aOutDevTest;
         BitmapEx aBitmapEx = aOutDevTest.setupDrawBlend();
         auto eResult = vcl::test::OutputDeviceTestBitmap::checkBlend(aBitmapEx);
@@ -458,6 +512,8 @@ public:
 
     void testDrawXor()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupXOR();
         auto eResult = vcl::test::OutputDeviceTestAnotherOutDev::checkXOR(aBitmap);
@@ -468,6 +524,8 @@ public:
 
     void testClipRectangle()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestClip aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupClipRectangle();
         auto eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap);
@@ -478,6 +536,8 @@ public:
 
     void testClipPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestClip aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupClipPolygon();
         auto eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap);
@@ -488,6 +548,8 @@ public:
 
     void testClipPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestClip aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupClipPolyPolygon();
         auto eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap);
@@ -498,6 +560,8 @@ public:
 
     void testClipB2DPolyPolygon()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestClip aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupClipB2DPolyPolygon();
         auto eResult = vcl::test::OutputDeviceTestClip::checkClip(aBitmap);
@@ -508,6 +572,8 @@ public:
 
     void testDrawOutDev()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDrawOutDev();
         auto eResult = vcl::test::OutputDeviceTestAnotherOutDev::checkDrawOutDev(aBitmap);
@@ -518,6 +584,8 @@ public:
 
     void testDashedLine()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestLine aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupDashedLine();
         auto eResult = vcl::test::OutputDeviceTestLine::checkDashedLine(aBitmap);
@@ -528,6 +596,8 @@ public:
 
     void testErase()
     {
+        if (isWindowsRDP())
+            return;
         {
             // Create normal virtual device (no alpha).
             ScopedVclPtr<VirtualDevice> device
@@ -593,6 +663,8 @@ public:
 
     void testLinearGradient()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupLinearGradient();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradient(aBitmap);
@@ -603,6 +675,8 @@ public:
 
     void testLinearGradientAngled()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupLinearGradientAngled();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientAngled(aBitmap);
@@ -623,6 +697,8 @@ public:
 
     void testLinearGradientIntensity()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupLinearGradientIntensity();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientIntensity(aBitmap);
@@ -633,6 +709,8 @@ public:
 
     void testLinearGradientSteps()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupLinearGradientSteps();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkLinearGradientSteps(aBitmap);
@@ -643,6 +721,8 @@ public:
 
     void testAxialGradient()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupAxialGradient();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkAxialGradient(aBitmap);
@@ -653,6 +733,8 @@ public:
 
     void testRadialGradient()
     {
+        if (isWindowsRDP())
+            return;
         vcl::test::OutputDeviceTestGradient aOutDevTest;
         Bitmap aBitmap = aOutDevTest.setupRadialGradient();
         auto eResult = vcl::test::OutputDeviceTestGradient::checkRadialGradient(aBitmap);
@@ -676,6 +758,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);
@@ -728,6 +812,8 @@ public:
     {
 // TODO: This unit test is not executed for macOS unless bitmap scaling is implemented
 #ifndef MACOSX
+        if (isWindowsRDP())
+            return;
         // Normal virtual device.
         ScopedVclPtr<VirtualDevice> device = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT);
         // Virtual device with alpha.
@@ -822,6 +908,8 @@ public:
 
     void testTdf136171()
     {
+        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 8a60eebbc44c..e416ba35e38b 100644
--- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
+++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx
@@ -122,6 +122,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