[Libreoffice-commits] .: sw/qa
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed May 9 04:10:38 PDT 2012
sw/qa/extras/rtftok/rtftok.cxx | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
New commits:
commit 93a7ad0b686ec772a3988256a7856f2130cf8ae7
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed May 9 12:51:01 2012 +0200
rtftok test: clean up by introducing getStyles() helper
Change-Id: I5759d748efb1ed0aa0376de50eb16ba10e63c280
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index e6de843..8b41569 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -139,6 +139,7 @@ private:
int getLength();
/// Get page count.
int getPages();
+ uno::Reference<container::XNameAccess> getStyles(OUString aFamily);
uno::Reference<lang::XComponent> mxComponent;
};
@@ -175,6 +176,14 @@ int Test::getPages()
return xCursor->getPage();
}
+uno::Reference<container::XNameAccess> Test::getStyles(OUString aFamily)
+{
+ uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName(aFamily), uno::UNO_QUERY);
+ return xPageStyles;
+}
+
void Test::setUp()
{
test::BootstrapFixture::setUp();
@@ -332,10 +341,7 @@ void Test::testFdo46662()
{
load("fdo46662.rtf");
- uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xNumberingStyles(xStyles->getByName("NumberingStyles"), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xPropertySet(xNumberingStyles->getByName("WWNum3"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProps;
xLevels->getByIndex(1) >>= aProps; // 2nd level
@@ -487,10 +493,7 @@ void Test::testFdo45394()
{
load("fdo45394.rtf");
- uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName("PageStyles"), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xPropertySet(xPageStyles->getByName("Default"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
uno::Reference<text::XText> xHeaderText(xPropertySet->getPropertyValue("HeaderText"), uno::UNO_QUERY);
OUString aActual = xHeaderText->getString();
// Encoding in the header was wrong.
@@ -512,9 +515,7 @@ void Test::testFdo47107()
{
load("fdo47107.rtf");
- uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xNumberingStyles(xStyles->getByName("NumberingStyles"), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xNumberingStyles(getStyles("NumberingStyles"));
// Make sure numbered and bullet legacy syntax is recognized, this used to throw a NoSuchElementException
xNumberingStyles->getByName("WWNum1");
xNumberingStyles->getByName("WWNum2");
@@ -536,9 +537,7 @@ void Test::testFdo44176()
{
load("fdo44176.rtf");
- uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName("PageStyles"), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xDefault(xPageStyles->getByName("Default"), uno::UNO_QUERY);
sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0;
@@ -707,10 +706,7 @@ void Test::testFdo49501()
{
load("fdo49501.rtf");
- uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName("PageStyles"), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xStyle(xPageStyles->getByName("Default"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
sal_Bool bIsLandscape = sal_False;
xStyle->getPropertyValue("IsLandscape") >>= bIsLandscape;
More information about the Libreoffice-commits
mailing list