sd/qa/unit/tiledrendering/tiledrendering.cxx |   82 +++++++++++++++------------
 1 file changed, 48 insertions(+), 34 deletions(-)

New commits:
commit 7dd6d5f7893184ee285e7d78ba101082d55eff4b
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Sun Nov 17 21:43:21 2024 +0100
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Mon Nov 18 03:26:44 2024 +0100

    lok: slideshow: support for skipping bg and mp rendering - followup
    
    Unit test helper function needs to provide info about the layer group and 
index
    or in case of test failure we don't know on which layer occurred.
    
    Change-Id: Ie667e3efd781fb75b66de74accd032fc2539be82
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176696
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index a50a635fb78e..f0c4601137b3 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3298,12 +3298,15 @@ public:
 
     void checkTextFieldLayer(int nIndex, const std::string& rTextFieldType)
     {
+        const std::string sMsg
+            = "TextField Layer Type: " + rTextFieldType + " Index: " + 
std::to_string(nIndex);
+
         std::vector<sal_uInt8> pBuffer(mnViewWidth * mnViewHeight * 4);
         bool bIsBitmapLayer = false;
         OUString aJson;
-        CPPUNIT_ASSERT(
-            !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, aJson));
-        CPPUNIT_ASSERT(bIsBitmapLayer);
+        CPPUNIT_ASSERT_MESSAGE(
+            sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, aJson));
+        CPPUNIT_ASSERT_MESSAGE(sMsg, bIsBitmapLayer);
 
         debugWriteImageToFile(mnImageFileStep++, pBuffer, mnViewWidth, 
mnViewHeight,
                               aJson.toUtf8().getStr());
@@ -3311,56 +3314,66 @@ public:
         boost::property_tree::ptree aTree;
         readJSON(aTree, aJson);
 
-        CPPUNIT_ASSERT_EQUAL(std::string("TextFields"),
-                             
aTree.get_child("group").get_value<std::string>());
-        CPPUNIT_ASSERT_EQUAL(nIndex, 
aTree.get_child("index").get_value<int>());
-        CPPUNIT_ASSERT_EQUAL(true, has_child(aTree, "content"));
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, std::string("TextFields"),
+                                     
aTree.get_child("group").get_value<std::string>());
+
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, std::string("TextFields"),
+                                     
aTree.get_child("group").get_value<std::string>());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, nIndex, 
aTree.get_child("index").get_value<int>());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, true, has_child(aTree, "content"));
         {
             auto aContentChild = aTree.get_child("content");
-            CPPUNIT_ASSERT_EQUAL(rTextFieldType,
-                                 
aContentChild.get_child("type").get_value<std::string>());
-            CPPUNIT_ASSERT_EQUAL(true, has_child(aContentChild, "content"));
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, rTextFieldType,
+                                         
aContentChild.get_child("type").get_value<std::string>());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, true, has_child(aContentChild, 
"content"));
             auto aContentChildChild = aContentChild.get_child("content");
-            CPPUNIT_ASSERT_EQUAL(std::string("%IMAGETYPE%"),
-                                 
aContentChildChild.get_child("type").get_value<std::string>());
-            CPPUNIT_ASSERT_EQUAL(std::string("%IMAGECHECKSUM%"),
-                                 
aContentChildChild.get_child("checksum").get_value<std::string>());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                sMsg, std::string("%IMAGETYPE%"),
+                aContentChildChild.get_child("type").get_value<std::string>());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                sMsg, std::string("%IMAGECHECKSUM%"),
+                
aContentChildChild.get_child("checksum").get_value<std::string>());
         }
     }
 
-    void checkPlaceholderLayer(int index, const std::string& rTextFieldType)
+    void checkPlaceholderLayer(int nIndex, const std::string& rTextFieldType)
     {
+        const std::string sMsg
+            = "Placeholder Layer Type: " + rTextFieldType + " Index: " + 
std::to_string(nIndex);
+
         std::vector<sal_uInt8> pBuffer(mnViewWidth * mnViewHeight * 4);
         bool bIsBitmapLayer = true;
         OUString aJson;
-        CPPUNIT_ASSERT(
-            !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, aJson));
-        CPPUNIT_ASSERT(!bIsBitmapLayer);
+        CPPUNIT_ASSERT_MESSAGE(
+            sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, aJson));
+        CPPUNIT_ASSERT_MESSAGE(sMsg, !bIsBitmapLayer);
 
         boost::property_tree::ptree aTree;
         readJSON(aTree, aJson);
 
-        CPPUNIT_ASSERT_EQUAL(std::string("MasterPage"),
-                             
aTree.get_child("group").get_value<std::string>());
-        CPPUNIT_ASSERT_EQUAL(index, aTree.get_child("index").get_value<int>());
-        CPPUNIT_ASSERT_EQUAL(std::string("placeholder"),
-                             aTree.get_child("type").get_value<std::string>());
-        CPPUNIT_ASSERT_EQUAL(true, has_child(aTree, "content"));
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, std::string("MasterPage"),
+                                     
aTree.get_child("group").get_value<std::string>());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, nIndex, 
aTree.get_child("index").get_value<int>());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, std::string("placeholder"),
+                                     
aTree.get_child("type").get_value<std::string>());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, true, has_child(aTree, "content"));
         {
             auto aContentChild = aTree.get_child("content");
-            CPPUNIT_ASSERT_EQUAL(rTextFieldType,
-                                 
aContentChild.get_child("type").get_value<std::string>());
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, rTextFieldType,
+                                         
aContentChild.get_child("type").get_value<std::string>());
         }
     }
 
     void checkPageLayer(int nIndex, const std::string& rGroup)
     {
+        const std::string sMsg = rGroup + " Layer Index: " + 
std::to_string(nIndex);
+
         std::vector<sal_uInt8> pBuffer(mnViewWidth * mnViewHeight * 4);
         bool bIsBitmapLayer = false;
         OUString aJson;
-        CPPUNIT_ASSERT(
-            !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, aJson));
-        CPPUNIT_ASSERT(bIsBitmapLayer);
+        CPPUNIT_ASSERT_MESSAGE(
+            sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), 
bIsBitmapLayer, aJson));
+        CPPUNIT_ASSERT_MESSAGE(sMsg, bIsBitmapLayer);
 
         debugWriteImageToFile(mnImageFileStep++, pBuffer, mnViewWidth, 
mnViewHeight,
                               aJson.toUtf8().getStr());
@@ -3368,11 +3381,12 @@ public:
         boost::property_tree::ptree aTree;
         readJSON(aTree, aJson);
 
-        CPPUNIT_ASSERT_EQUAL(rGroup, 
aTree.get_child("group").get_value<std::string>());
-        CPPUNIT_ASSERT_EQUAL(nIndex, 
aTree.get_child("index").get_value<int>());
-        CPPUNIT_ASSERT_EQUAL(std::string("bitmap"),
-                             aTree.get_child("type").get_value<std::string>());
-        CPPUNIT_ASSERT_EQUAL(true, has_child(aTree, "content"));
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, rGroup,
+                                     
aTree.get_child("group").get_value<std::string>());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, nIndex, 
aTree.get_child("index").get_value<int>());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, std::string("bitmap"),
+                                     
aTree.get_child("type").get_value<std::string>());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg, true, has_child(aTree, "content"));
     }
 
     void checkFinalEmptyLayer()

Reply via email to