editeng/source/items/frmitems.cxx | 6 ++++++ sw/qa/extras/inc/swmodeltestbase.hxx | 10 ++++++++-- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 +++++--- sw/qa/extras/rtfimport/rtfimport.cxx | 13 +++++++------ 4 files changed, 26 insertions(+), 11 deletions(-)
New commits: commit 9bb04da4bb18342a107bb843d8054e178d97ae28 Author: Michael Stahl <mst...@redhat.com> Date: Mon Sep 29 23:44:08 2014 +0200 sw: when getting a property value in a unit test, a void result is a bug Change-Id: Iba0e43c198c3380426d0572427c591f4d77ba09b diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index fdce9f1..154d18c 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -403,7 +403,10 @@ protected: { uno::Reference< beans::XPropertySet > properties( obj, uno::UNO_QUERY_THROW ); T data = T(); - properties->getPropertyValue( name ) >>= data; + if (!(properties->getPropertyValue(name) >>= data)) + { + CPPUNIT_FAIL("the property is of unexpected type or void"); + } return data; } @@ -412,7 +415,10 @@ protected: { uno::Reference< beans::XPropertySet > properties( obj, uno::UNO_QUERY_THROW ); T data = T(); - properties->getPropertyValue( name ) >>= data; + if (!(properties->getPropertyValue(name) >>= data)) + { + CPPUNIT_FAIL("the property is of unexpected type or void"); + } return data; } diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index eca11e6..fe0241e 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2349,9 +2349,11 @@ DECLARE_OOXMLIMPORT_TEST(testBnc519228OddBreaks, "bnc519228_odd-breaks.docx") // Page2 comes from follow of style for page 1 and should be a normal page. Also check the two page style have the same properties, // since page style for page1 was created from page style for page 2. - OUString page2StyleName = getProperty<OUString>( getParagraph( 3, "This is page 2, which is obviously an even page." ), "PageDescName"); - CPPUNIT_ASSERT_EQUAL(OUString(), page2StyleName); - page2StyleName = getProperty<OUString>( page1Style, "FollowStyle" ); + uno::Any page2StyleAny = uno::Reference<beans::XPropertySet>( + getParagraph(3, "This is page 2, which is obviously an even page."), + uno::UNO_QUERY_THROW)->getPropertyValue("PageDescName"); + CPPUNIT_ASSERT_EQUAL(uno::Any(), page2StyleAny); + OUString page2StyleName = getProperty<OUString>( page1Style, "FollowStyle" ); uno::Reference<beans::XPropertySet> page2Style(getStyles("PageStyles")->getByName(page2StyleName), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), page2Style->getPropertyValue("PageStyleLayout")); getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page2Style, "HeaderTextLeft"), "This is the even header"); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 2b2764e..a61d62f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1536,7 +1536,7 @@ DECLARE_RTFIMPORT_TEST(testFdo68291, "fdo68291.odt") paste("fdo68291-paste.rtf", xEnd); // This was "Standard", causing an unwanted page break on next paste. - CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(1), "PageDescName")); + CPPUNIT_ASSERT_EQUAL(uno::Any(), uno::Reference<beans::XPropertySet>(getParagraph(1), uno::UNO_QUERY)->getPropertyValue("PageDescName")); } DECLARE_RTFIMPORT_TEST(testFdo69384, "hello.rtf") @@ -1630,8 +1630,8 @@ DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf") CPPUNIT_ASSERT_EQUAL(OUString("SECOND"), xParaSecond->getString()); CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, getProperty<style::BreakType>(xParaSecond, "BreakType")); - CPPUNIT_ASSERT_EQUAL(OUString(""), - getProperty<OUString>(xParaSecond, "PageDescName")); + CPPUNIT_ASSERT_EQUAL(uno::Any(), + uno::Reference<beans::XPropertySet>(xParaSecond, uno::UNO_QUERY)->getPropertyValue("PageDescName")); // actually not sure how many paragraph there should be between // SECOND and THIRD - important is that the page break is on there uno::Reference<text::XTextRange> xParaNext = getParagraph(3); @@ -1642,8 +1642,8 @@ DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf") CPPUNIT_ASSERT_EQUAL(OUString("THIRD"), xParaThird->getString()); CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, getProperty<style::BreakType>(xParaThird, "BreakType")); - CPPUNIT_ASSERT_EQUAL(OUString(""), - getProperty<OUString>(xParaThird, "PageDescName")); + CPPUNIT_ASSERT_EQUAL(uno::Any(), + uno::Reference<beans::XPropertySet>(xParaThird, uno::UNO_QUERY)->getPropertyValue("PageDescName")); CPPUNIT_ASSERT_EQUAL(2, getPages()); } commit 09046504749cb59cc5b8f257658f49ffa93622c9 Author: Michael Stahl <mst...@redhat.com> Date: Tue Sep 30 21:09:27 2014 +0200 actually the LineStyle property is *write-only* ... which is highly suspect in any case, but whatever. Change-Id: Ibeff36a7d30750fc33e9729b067f86b3901d1c76 diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 315a332..f184a28 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1716,6 +1716,12 @@ bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const nDist = nRightDist; bDistMember = true; break; + case LINE_STYLE: + case LINE_WIDTH: + // it doesn't make sense to return a value for these since it's + // probably ambiguous + return true; + break; } if( bDistMember ) diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index e124644..2b2764e 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -881,7 +881,8 @@ DECLARE_RTFIMPORT_TEST(testDoDhgt, "do-dhgt.rtf") DECLARE_RTFIMPORT_TEST(testDplinehollow, "dplinehollow.rtf") { uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty<drawing::LineStyle>(xPropertySet, "LineStyle")); + table::BorderLine2 line(getProperty<table::BorderLine2>(xPropertySet, "TopBorder")); + CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::NONE, line.LineStyle); } DECLARE_RTFIMPORT_TEST(testLeftmarginDefault, "leftmargin-default.rtf") _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits