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@redhat.com>
This commit is contained in:
Stephan Bergmann
2019-12-03 13:17:43 +01:00
parent 0cf64cf29c
commit 815fad1e55
3 changed files with 14 additions and 14 deletions

View File

@@ -78,7 +78,7 @@ void CaptionShape::testCaptionShapeProperties()
captionIsFixedAngleSet, !captionIsFixedAngleGet); captionIsFixedAngleSet, !captionIsFixedAngleGet);
propName = "CaptionAngle"; propName = "CaptionAngle";
sal_Int32 captionAngleGet; sal_Int32 captionAngleGet = {};
CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionAngle", CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionAngle",
xCaptionShape->getPropertyValue(propName) >>= captionAngleGet); xCaptionShape->getPropertyValue(propName) >>= captionAngleGet);
@@ -90,7 +90,7 @@ void CaptionShape::testCaptionShapeProperties()
captionAngleGet + 5); captionAngleGet + 5);
propName = "CaptionGap"; propName = "CaptionGap";
sal_Int32 captionGapGet; sal_Int32 captionGapGet = {};
CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionGap", CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionGap",
xCaptionShape->getPropertyValue(propName) >>= captionGapGet); xCaptionShape->getPropertyValue(propName) >>= captionGapGet);
@@ -102,7 +102,7 @@ void CaptionShape::testCaptionShapeProperties()
captionGapGet + 5); captionGapGet + 5);
propName = "CaptionEscapeDirection"; propName = "CaptionEscapeDirection";
sal_Int32 captionEscapeDirectionGet; sal_Int32 captionEscapeDirectionGet = {};
CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeDirection", CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeDirection",
xCaptionShape->getPropertyValue(propName) >>= captionEscapeDirectionGet); xCaptionShape->getPropertyValue(propName) >>= captionEscapeDirectionGet);
@@ -127,7 +127,7 @@ void CaptionShape::testCaptionShapeProperties()
captionIsEscapeRelativeSet, !captionIsEscapeRelativeGet); captionIsEscapeRelativeSet, !captionIsEscapeRelativeGet);
propName = "CaptionEscapeRelative"; propName = "CaptionEscapeRelative";
sal_Int32 captionEscapeRelativeGet; sal_Int32 captionEscapeRelativeGet = {};
CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeRelative", CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeRelative",
xCaptionShape->getPropertyValue(propName) >>= captionEscapeRelativeGet); xCaptionShape->getPropertyValue(propName) >>= captionEscapeRelativeGet);
@@ -139,7 +139,7 @@ void CaptionShape::testCaptionShapeProperties()
captionEscapeRelativeSet, captionEscapeRelativeGet + 5); captionEscapeRelativeSet, captionEscapeRelativeGet + 5);
propName = "CaptionEscapeAbsolute"; propName = "CaptionEscapeAbsolute";
sal_Int32 captionEscapeAbsoluteGet; sal_Int32 captionEscapeAbsoluteGet = {};
CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeAbsolute", CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionEscapeAbsolute",
xCaptionShape->getPropertyValue(propName) >>= captionEscapeAbsoluteGet); xCaptionShape->getPropertyValue(propName) >>= captionEscapeAbsoluteGet);
@@ -151,7 +151,7 @@ void CaptionShape::testCaptionShapeProperties()
captionEscapeAbsoluteSet, captionEscapeAbsoluteGet + 5); captionEscapeAbsoluteSet, captionEscapeAbsoluteGet + 5);
propName = "CaptionLineLength"; propName = "CaptionLineLength";
sal_Int32 captionLineLengthGet; sal_Int32 captionLineLengthGet = {};
CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionLineLength", CPPUNIT_ASSERT_MESSAGE("Unable to get the PropertyValue of CaptionLineLength",
xCaptionShape->getPropertyValue(propName) >>= captionLineLengthGet); xCaptionShape->getPropertyValue(propName) >>= captionLineLengthGet);

View File

@@ -49,34 +49,34 @@ void Shape::testShapePropertiesAnchor()
xShape->getPropertyValue("Anchor") >>= xCellGet); xShape->getPropertyValue("Anchor") >>= xCellGet);
// Shape should not resize with cell by default // Shape should not resize with cell by default
bool bIsResizeWithCell; bool bIsResizeWithCell = {};
xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell; CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell);
CPPUNIT_ASSERT_MESSAGE("Shape should not resize with the cell", !bIsResizeWithCell); CPPUNIT_ASSERT_MESSAGE("Shape should not resize with the cell", !bIsResizeWithCell);
xShape->setPropertyValue("ResizeWithCell", uno::Any(true)); 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); CPPUNIT_ASSERT_MESSAGE("Shape should resize with the cell", bIsResizeWithCell);
// Anchoring to a different cell should keep the "ResizeWithCell" attribute // Anchoring to a different cell should keep the "ResizeWithCell" attribute
uno::Reference<table::XCell> xCell2(xSheet->getCellByPosition(1, 2), UNO_SET_THROW); uno::Reference<table::XCell> xCell2(xSheet->getCellByPosition(1, 2), UNO_SET_THROW);
aNewValue <<= xCell2; aNewValue <<= xCell2;
xShape->setPropertyValue("Anchor", aNewValue); xShape->setPropertyValue("Anchor", aNewValue);
xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell; CPPUNIT_ASSERT(xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell);
CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should still be set", bIsResizeWithCell); CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should still be set", bIsResizeWithCell);
// Now anchor to sheet again // Now anchor to sheet again
aNewValue <<= xSheet; aNewValue <<= xSheet;
xShape->setPropertyValue("Anchor", aNewValue); xShape->setPropertyValue("Anchor", aNewValue);
xShape->getPropertyValue("Anchor") >>= xSheetGet; CPPUNIT_ASSERT(xShape->getPropertyValue("Anchor") >>= xSheetGet);
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Anchor (XSpreadsheet)", CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue Anchor (XSpreadsheet)",
xShape->getPropertyValue("Anchor") >>= xSheetGet); xShape->getPropertyValue("Anchor") >>= xSheetGet);
// Setting ResizeWithCell while anchored to page should not have any effect // 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", CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should be false for sheet anchored shapes",
!bIsResizeWithCell); !bIsResizeWithCell);
xShape->setPropertyValue("ResizeWithCell", uno::Any(true)); 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", CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should be unchangeable for sheet anchored shapes",
!bIsResizeWithCell); !bIsResizeWithCell);
} }

View File

@@ -72,7 +72,7 @@ void testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet>
if (!extstsProperty(rxSettings, rPropertyName)) if (!extstsProperty(rxSettings, rPropertyName))
return; // Property is optional return; // Property is optional
sal_Int16 aValue_Get; sal_Int16 aValue_Get = {};
CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue", CPPUNIT_ASSERT_MESSAGE("Unable to get PropertyValue",
rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get); rxSettings->getPropertyValue(rPropertyName) >>= aValue_Get);