[Libreoffice-commits] core.git: test/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 3 18:44:19 UTC 2019


 test/source/drawing/captionshape.cxx |   12 ++++++------
 test/source/sheet/shape.cxx          |   14 +++++++-------
 test/source/text/textsettings.cxx    |    2 +-
 3 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 815fad1e55ebd3f1e98a2e062af2d59caed2ac3e
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:17:43 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Dec 3 19:42:51 2019 +0100

    Silence false -Werror=maybe-uninitialized
    
    ...where success of >>= has already been checked with CPPUNIT_ASSERT
    
    Change-Id: I9aa553749988b6b2e26d9a5ac5b376cc5997aba7
    Reviewed-on: https://gerrit.libreoffice.org/84335
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/test/source/drawing/captionshape.cxx b/test/source/drawing/captionshape.cxx
index 70d0b8007a37..807b2ee08379 100644
--- a/test/source/drawing/captionshape.cxx
+++ b/test/source/drawing/captionshape.cxx
@@ -78,7 +78,7 @@ void CaptionShape::testCaptionShapeProperties()
                                  captionIsFixedAngleSet, !captionIsFixedAngleGet);
 
     propName = "CaptionAngle";
-    sal_Int32 captionAngleGet;
+    sal_Int32 captionAngleGet = {};
     CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionAngle",
                            xCaptionShape->getPropertyValue(propName) >>= captionAngleGet);
 
@@ -90,7 +90,7 @@ void CaptionShape::testCaptionShapeProperties()
                                  captionAngleGet + 5);
 
     propName = "CaptionGap";
-    sal_Int32 captionGapGet;
+    sal_Int32 captionGapGet = {};
     CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionGap",
                            xCaptionShape->getPropertyValue(propName) >>= captionGapGet);
 
@@ -102,7 +102,7 @@ void CaptionShape::testCaptionShapeProperties()
                                  captionGapGet + 5);
 
     propName = "CaptionEscapeDirection";
-    sal_Int32 captionEscapeDirectionGet;
+    sal_Int32 captionEscapeDirectionGet = {};
     CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeDirection",
                            xCaptionShape->getPropertyValue(propName) >>= captionEscapeDirectionGet);
 
@@ -127,7 +127,7 @@ void CaptionShape::testCaptionShapeProperties()
                                  captionIsEscapeRelativeSet, !captionIsEscapeRelativeGet);
 
     propName = "CaptionEscapeRelative";
-    sal_Int32 captionEscapeRelativeGet;
+    sal_Int32 captionEscapeRelativeGet = {};
     CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeRelative",
                            xCaptionShape->getPropertyValue(propName) >>= captionEscapeRelativeGet);
 
@@ -139,7 +139,7 @@ void CaptionShape::testCaptionShapeProperties()
                                  captionEscapeRelativeSet, captionEscapeRelativeGet + 5);
 
     propName = "CaptionEscapeAbsolute";
-    sal_Int32 captionEscapeAbsoluteGet;
+    sal_Int32 captionEscapeAbsoluteGet = {};
     CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeAbsolute",
                            xCaptionShape->getPropertyValue(propName) >>= captionEscapeAbsoluteGet);
 
@@ -151,7 +151,7 @@ void CaptionShape::testCaptionShapeProperties()
                                  captionEscapeAbsoluteSet, captionEscapeAbsoluteGet + 5);
 
     propName = "CaptionLineLength";
-    sal_Int32 captionLineLengthGet;
+    sal_Int32 captionLineLengthGet = {};
     CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionLineLength",
                            xCaptionShape->getPropertyValue(propName) >>= captionLineLengthGet);
 
diff --git a/test/source/sheet/shape.cxx b/test/source/sheet/shape.cxx
index b147ad1ee28c..9e291be2650b 100644
--- a/test/source/sheet/shape.cxx
+++ b/test/source/sheet/shape.cxx
@@ -49,34 +49,34 @@ void Shape::testShapePropertiesAnchor()
                            xShape->getPropertyValue("Anchor") >>= xCellGet);
 
     // Shape should not resize with cell by default
-    bool bIsResizeWithCell;
-    xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell;
+    bool bIsResizeWithCell = {};
+    CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell);
     CPPUNIT_ASSERT_MESSAGE("Shape should not resize with the cell", !bIsResizeWithCell);
 
     xShape->setPropertyValue("ResizeWithCell", uno::Any(true));
-    xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell;
+    CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell);
     CPPUNIT_ASSERT_MESSAGE("Shape should resize with the cell", bIsResizeWithCell);
 
     // Anchoring to a different cell should keep the "ResizeWithCell" attribute
     uno::Reference<table::XCell> xCell2(xSheet->getCellByPosition(1, 2), UNO_SET_THROW);
     aNewValue <<= xCell2;
     xShape->setPropertyValue("Anchor", aNewValue);
-    xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell;
+    CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell);
     CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should still be set", bIsResizeWithCell);
 
     // Now anchor to sheet again
     aNewValue <<= xSheet;
     xShape->setPropertyValue("Anchor", aNewValue);
-    xShape->getPropertyValue("Anchor") >>= xSheetGet;
+    CPPUNIT_ASSERT(xShape->getPropertyValue("Anchor") >>= xSheetGet);
     CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Anchor (XSpreadsheet)",
                            xShape->getPropertyValue("Anchor") >>= xSheetGet);
 
     // Setting ResizeWithCell while anchored to page should not have any effect
-    xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell;
+    CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell);
     CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should be false for sheet anchored shapes",
                            !bIsResizeWithCell);
     xShape->setPropertyValue("ResizeWithCell", uno::Any(true));
-    xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell;
+    CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell);
     CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should be unchangeable for sheet anchored shapes",
                            !bIsResizeWithCell);
 }
diff --git a/test/source/text/textsettings.cxx b/test/source/text/textsettings.cxx
index 6e64264f0e0f..88e78d98a5a8 100644
--- a/test/source/text/textsettings.cxx
+++ b/test/source/text/textsettings.cxx
@@ -72,7 +72,7 @@ void testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet>
     if (!extstsProperty(rxSettings, rPropertyName))
         return; // Property is optional
 
-    sal_Int16 aValue_Get;
+    sal_Int16 aValue_Get = {};
 
     CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue",
                            rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get);


More information about the Libreoffice-commits mailing list