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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 20 15:53:56 UTC 2020


 svx/qa/unit/customshapes.cxx |   35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

New commits:
commit 82b1bcf7d23d3795347fb45c09ea3c836c246bd3
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Oct 20 12:21:24 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Oct 20 17:53:18 2020 +0200

    CppunitTest_svx_unit: directly use asserts here
    
    if it failed, it wouldn't be clear why
    
    Change-Id: Ib96674a2d243bea946abff429a267c3ce4fc64f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104559
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index e42c7ad2fde9..763135208c92 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -514,25 +514,30 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf126060_3D_Z_Rotation)
     OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + "tdf126060_3D_Z_Rotation.pptx";
     mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.drawing.DrawingDocument");
     CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
-    OUString sErrors; // sErrors collects the errors and should be empty in case all is OK.
 
     uno::Reference<drawing::XShape> xShape(getShape(0));
     SdrObjCustomShape& rSdrObjCustomShape(
         static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape)));
 
-    if (rSdrObjCustomShape.GetCameraZRotation() != 90)
-        sErrors += "Wrong text camera Z rotation";
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong text camera Z rotation", 90.0,
+                                 rSdrObjCustomShape.GetCameraZRotation());
 
     basegfx::B2DHomMatrix aObjectTransform;
     basegfx::B2DPolyPolygon aObjectPolyPolygon;
     rSdrObjCustomShape.TRGetBaseGeometry(aObjectTransform, aObjectPolyPolygon);
 
-    if (aObjectTransform.get(0, 0) != 1492 || aObjectTransform.get(0, 1) != 0
-        || aObjectTransform.get(0, 2) != 1129 || aObjectTransform.get(1, 0) != 0
-        || aObjectTransform.get(1, 1) != 2500 || aObjectTransform.get(1, 2) != 5846)
-        sErrors += " Wrong transformation matrix";
-
-    CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 0,0 position", 1492.0,
+                                 aObjectTransform.get(0, 0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 0,1 position", 0.0,
+                                 aObjectTransform.get(0, 1));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 0,2 position", 1129.0,
+                                 aObjectTransform.get(0, 2));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 1,0 position", 0.0,
+                                 aObjectTransform.get(1, 0));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 1,1 position", 2500.0,
+                                 aObjectTransform.get(1, 1));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong transformation at 1,2 position", 5846.0,
+                                 aObjectTransform.get(1, 2));
 }
 
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Asymmetric)
@@ -621,13 +626,11 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf128413_tbrlOnOff)
 
     awt::Rectangle aObservedRect;
     xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= aObservedRect;
-    OUString sError;
-    if (aOrigRect.Width != aObservedRect.Width || aOrigRect.Height != aObservedRect.Height
-        || aOrigRect.X != aObservedRect.X || aOrigRect.Y != aObservedRect.Y)
-    {
-        sError = "Shape has wrong size or wrong position.";
-    }
-    CPPUNIT_ASSERT_EQUAL(OUString(), sError);
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape has wrong width", aOrigRect.Width, aObservedRect.Width);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape has wrong height", aOrigRect.Height, aObservedRect.Height);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape has wrong X position", aOrigRect.X, aObservedRect.X);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape has wrong Y position", aOrigRect.Y, aObservedRect.Y);
 }
 
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf129532_MatrixFlipV)


More information about the Libreoffice-commits mailing list