[Libreoffice-commits] core.git: sd/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 15 13:12:55 UTC 2021


 sd/qa/unit/import-tests.cxx |   24 ++++++++++++------------
 sd/qa/unit/uiimpress.cxx    |    6 +++---
 2 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 6614144435b9e9143a4d20c46a727ddbca5b18e8
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 15 12:53:54 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 15 15:12:09 2021 +0200

    sd: just use Color in these asserts
    
    if they fail, the output is much more readable since
    a080727522e04b8e1fc1641c892af9227d2e8dad
    < sd: improve output when asserting colors >
    
    Change-Id: I9f95943f35d095054ad5adaede5a8e53ce6cd69c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114138
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index c24ea0e02c30..a1f21f97394a 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -749,7 +749,7 @@ void SdImportTest::testFdo68594()
     const SvxColorItem *pC = &pTxtObj->GetMergedItem(EE_CHAR_COLOR);
     CPPUNIT_ASSERT_MESSAGE( "no color item", pC != nullptr);
     // Color should be black
-    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Placeholder color mismatch", sal_uInt32(0x0), sal_uInt32(pC->GetValue()) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Placeholder color mismatch", COL_BLACK, pC->GetValue() );
 
     xDocShRef->DoClose();
 }
@@ -1197,7 +1197,7 @@ void SdImportTest::testBnc904423()
         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
                 pObj->GetMergedItem(XATTR_FILLCOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00CC99), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0x00CC99), rColorItem.GetColorValue());
     }
 
     // Second shape's background color is defined by theme
@@ -1210,7 +1210,7 @@ void SdImportTest::testBnc904423()
         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
                 pObj->GetMergedItem(XATTR_FILLCOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x3333CC), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0x3333CC), rColorItem.GetColorValue());
     }
 
     // Third shape's background color is defined by direct formatting
@@ -1223,7 +1223,7 @@ void SdImportTest::testBnc904423()
         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
                 pObj->GetMergedItem(XATTR_FILLCOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), rColorItem.GetColorValue());
     }
 
     xDocShRef->DoClose();
@@ -1247,7 +1247,7 @@ void SdImportTest::testShapeLineStyle()
 
         const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
                 pObj->GetMergedItem(XATTR_LINECOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), rColorItem.GetColorValue());
 
         const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
                 pObj->GetMergedItem(XATTR_LINEWIDTH));
@@ -1265,7 +1265,7 @@ void SdImportTest::testShapeLineStyle()
 
         const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
                 pObj->GetMergedItem(XATTR_LINECOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x3333CC), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0x3333CC), rColorItem.GetColorValue());
 
         const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
                 pObj->GetMergedItem(XATTR_LINEWIDTH));
@@ -1283,7 +1283,7 @@ void SdImportTest::testShapeLineStyle()
 
         const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
                 pObj->GetMergedItem(XATTR_LINECOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x7030A0), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0x7030A0), rColorItem.GetColorValue());
 
         const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
                 pObj->GetMergedItem(XATTR_LINEWIDTH));
@@ -1853,7 +1853,7 @@ void SdImportTest::testTdf95932()
     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
     const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
         pObj->GetMergedItem(XATTR_FILLCOLOR));
-    CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x76bf3d), sal_uInt32(rColorItem.GetColorValue()));
+    CPPUNIT_ASSERT_EQUAL(Color(0x76bf3d), rColorItem.GetColorValue());
 
     xDocShRef->DoClose();
 }
@@ -2137,7 +2137,7 @@ void SdImportTest::testTdf104015()
         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
                 pObj->GetMergedItem(XATTR_FILLCOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xFF0000), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), rColorItem.GetColorValue());
     }
     // Should have a blue line
     {
@@ -2147,7 +2147,7 @@ void SdImportTest::testTdf104015()
 
         const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
                 pObj->GetMergedItem(XATTR_LINECOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x0000FF), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0x0000FF), rColorItem.GetColorValue());
     }
     // Should have some shadow
     {
@@ -2176,7 +2176,7 @@ void SdImportTest::testTdf104201()
         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
             pObj->GetMergedItem(XATTR_FILLCOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FF00), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0x00FF00), rColorItem.GetColorValue());
     }
     // Second shape has blue fill, but this should be overwritten by green group fill
     {
@@ -2187,7 +2187,7 @@ void SdImportTest::testTdf104201()
         CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
         const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
             pObj->GetMergedItem(XATTR_FILLCOLOR));
-        CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x00FF00), sal_uInt32(rColorItem.GetColorValue()));
+        CPPUNIT_ASSERT_EQUAL(Color(0x00FF00), rColorItem.GetColorValue());
     }
 
     xDocShRef->DoClose();
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 7f9c176ab87e..3b25844dca24 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -523,7 +523,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testPageFillColor)
     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, eXFS);
 
     Color aColor = rPageAttr.GetItem(XATTR_FILLCOLOR)->GetColorValue();
-    CPPUNIT_ASSERT_EQUAL(OUString("ff0000"), aColor.AsRGBHexString());
+    CPPUNIT_ASSERT_EQUAL(Color(0xff0000), aColor);
 }
 
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testPageFillGradient)
@@ -553,8 +553,8 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testPageFillGradient)
     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, eXFS);
 
     XGradient aGradient = rPageAttr.GetItem(XATTR_FILLGRADIENT)->GetGradientValue();
-    CPPUNIT_ASSERT_EQUAL(OUString("ff0000"), aGradient.GetStartColor().AsRGBHexString());
-    CPPUNIT_ASSERT_EQUAL(OUString("0000ff"), aGradient.GetEndColor().AsRGBHexString());
+    CPPUNIT_ASSERT_EQUAL(Color(0xff0000), aGradient.GetStartColor());
+    CPPUNIT_ASSERT_EQUAL(Color(0x0000ff), aGradient.GetEndColor());
 }
 
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf134053)


More information about the Libreoffice-commits mailing list