[Libreoffice-commits] core.git: 3 commits - sw/qa
Michael Stahl
mstahl at redhat.com
Tue Jun 30 14:32:05 PDT 2015
dev/null |binary
sw/qa/extras/inc/swmodeltestbase.hxx | 12 ++-
sw/qa/extras/uiwriter/uiwriter.cxx | 135 +++++++++++++++++++++++++++++++++--
3 files changed, 140 insertions(+), 7 deletions(-)
New commits:
commit 9394362e10de6fe30e673efcdbe56d43579447b1
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jun 30 22:47:20 2015 +0200
sw: remove SwUiWriterTest's empty.odt
Change-Id: I44e2881bcf1d50fbc4d35802d90ea8ee19b39f3a
diff --git a/sw/qa/extras/uiwriter/data/empty.odt b/sw/qa/extras/uiwriter/data/empty.odt
deleted file mode 100644
index 311cb06..0000000
Binary files a/sw/qa/extras/uiwriter/data/empty.odt and /dev/null differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index c65fe61..0339860 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1399,8 +1399,7 @@ void SwUiWriterTest::testEmbeddedDataSource()
void SwUiWriterTest::testUnoCursorPointer()
{
- auto xDocComponent(loadFromDesktop(
- getURLFromSrc(DATA_DIRECTORY) + "empty.odt",
+ auto xDocComponent(loadFromDesktop("private:factory/swriter",
"com.sun.star.text.TextDocument"));
auto pxDocDocument(
dynamic_cast<SwXTextDocument *>(xDocComponent.get()));
commit 98ddd7a32fd0d5fa080fac368b9dc53a06659285
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jun 30 22:43:22 2015 +0200
sw: fix SwUiWriterTest pointlessly loading an "empty.odt" ...
... instead of just creating a new document.
Change-Id: Ib336c07f6827775a9c1a4fa0b8fbfe4ae0ff8221
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index e26b6e3..adf21ba 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -572,14 +572,20 @@ protected:
void load(const char* pDir, const char* pName)
{
+ return loadURL(getURLFromSrc(pDir) + OUString::createFromAscii(pName), pName);
+ }
+
+ void loadURL(OUString const& rURL, const char* pName)
+ {
if (mxComponent.is())
mxComponent->dispose();
// Output name early, so in the case of a hang, the name of the hanging input file is visible.
- std::cout << pName << ",";
+ if (pName)
+ std::cout << pName << ",";
mnStartTime = osl_getGlobalTimer();
- mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.text.TextDocument");
+ mxComponent = loadFromDesktop(rURL, "com.sun.star.text.TextDocument");
discardDumpedLayout();
- if (mustCalcLayoutOf(pName))
+ if (pName && mustCalcLayoutOf(pName))
calcLayout();
}
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 889eee5..c65fe61 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -169,8 +169,9 @@ private:
SwDoc* SwUiWriterTest::createDoc(const char* pName)
{
if (!pName)
- pName = "empty.odt";
- load(DATA_DIRECTORY, pName);
+ loadURL("private:factory/swriter", nullptr);
+ else
+ load(DATA_DIRECTORY, pName);
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
commit 9060439f98e771d5079fb4434e2152bee053c40d
Author: Varun <varun.dhall at studentpartner.com>
Date: Tue Jun 30 03:07:19 2015 +0530
Added Test for tdf#69282 copy page style b/w docs
Change-Id: If5960be7b04db418a1a42bd7b661391f65e79498
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 9f5a8fc..889eee5 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -35,6 +35,7 @@
#include <unocrsr.hxx>
#include <unocrsrhelper.hxx>
#include <unotbl.hxx>
+#include <pagedesc.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdview.hxx>
@@ -97,6 +98,8 @@ public:
void testTdf51741();
void testdelofTableRedlines();
void testExportToPicture();
+ void testTdf69282();
+ void testTdf69282WithMirror();
void testSearchWithTransliterate();
void testTdf75137();
void testTdf83798();
@@ -144,6 +147,8 @@ public:
CPPUNIT_TEST(testTdf51741);
CPPUNIT_TEST(testdelofTableRedlines);
CPPUNIT_TEST(testExportToPicture);
+ CPPUNIT_TEST(testTdf69282);
+ CPPUNIT_TEST(testTdf69282WithMirror);
CPPUNIT_TEST(testSearchWithTransliterate);
CPPUNIT_TEST(testTdf75137);
CPPUNIT_TEST(testTdf83798);
@@ -1018,6 +1023,128 @@ void SwUiWriterTest::testExportToPicture()
aTempFile.EnableKillingFile();
}
+void SwUiWriterTest::testTdf69282()
+{
+ mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ SwDoc* source = pTextDoc->GetDocShell()->GetDoc();
+ uno::Reference<lang::XComponent> xSourceDoc(mxComponent, uno::UNO_QUERY);
+ mxComponent.clear();
+ SwDoc* target = createDoc();
+ SwPageDesc* sPageDesc = source->MakePageDesc(OUString("SourceStyle"));
+ SwPageDesc* tPageDesc = target->MakePageDesc(OUString("TargetStyle"));
+ sPageDesc->ChgFirstShare(false);
+ CPPUNIT_ASSERT(!sPageDesc->IsFirstShared());
+ SwFrameFormat& sMasterFormat = sPageDesc->GetMaster();
+ //Setting horizontal spaces on master
+ SvxLRSpaceItem horizontalSpace(RES_LR_SPACE);
+ horizontalSpace.SetLeft(11);
+ horizontalSpace.SetRight(12);
+ sMasterFormat.SetFormatAttr(horizontalSpace);
+ //Setting vertical spaces on master
+ SvxULSpaceItem verticalSpace(RES_UL_SPACE);
+ verticalSpace.SetUpper(13);
+ verticalSpace.SetLower(14);
+ sMasterFormat.SetFormatAttr(verticalSpace);
+ //Changing the style and copying it to target
+ source->ChgPageDesc(OUString("SourceStyle"), *sPageDesc);
+ target->CopyPageDesc(*sPageDesc, *tPageDesc);
+ //Checking the set values on all Formats in target
+ SwFrameFormat& tMasterFormat = tPageDesc->GetMaster();
+ SwFrameFormat& tLeftFormat = tPageDesc->GetLeft();
+ SwFrameFormat& tFirstMasterFormat = tPageDesc->GetFirstMaster();
+ SwFrameFormat& tFirstLeftFormat = tPageDesc->GetFirstLeft();
+ //Checking horizontal spaces
+ const SvxLRSpaceItem hMasterFormatSpace = tMasterFormat.GetLRSpace();
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hMasterFormatSpace.GetLeft());
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hMasterFormatSpace.GetRight());
+ const SvxLRSpaceItem hLeftFormatSpace = tLeftFormat.GetLRSpace();
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hLeftFormatSpace.GetLeft());
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hLeftFormatSpace.GetRight());
+ const SvxLRSpaceItem hFirstMasterFormatSpace = tFirstMasterFormat.GetLRSpace();
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hFirstMasterFormatSpace.GetLeft());
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hFirstMasterFormatSpace.GetRight());
+ const SvxLRSpaceItem hFirstLeftFormatSpace = tFirstLeftFormat.GetLRSpace();
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hFirstLeftFormatSpace.GetLeft());
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hFirstLeftFormatSpace.GetRight());
+ //Checking vertical spaces
+ const SvxULSpaceItem vMasterFormatSpace = tMasterFormat.GetULSpace();
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vMasterFormatSpace.GetUpper());
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vMasterFormatSpace.GetLower());
+ const SvxULSpaceItem vLeftFormatSpace = tLeftFormat.GetULSpace();
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vLeftFormatSpace.GetUpper());
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vLeftFormatSpace.GetLower());
+ const SvxULSpaceItem vFirstMasterFormatSpace = tFirstMasterFormat.GetULSpace();
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vFirstMasterFormatSpace.GetUpper());
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vFirstMasterFormatSpace.GetLower());
+ const SvxULSpaceItem vFirstLeftFormatSpace = tFirstLeftFormat.GetULSpace();
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vFirstLeftFormatSpace.GetUpper());
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vFirstLeftFormatSpace.GetLower());
+ xSourceDoc->dispose();
+}
+
+void SwUiWriterTest::testTdf69282WithMirror()
+{
+ mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ SwDoc* source = pTextDoc->GetDocShell()->GetDoc();
+ uno::Reference<lang::XComponent> xSourceDoc(mxComponent, uno::UNO_QUERY);
+ mxComponent.clear();
+ SwDoc* target = createDoc();
+ SwPageDesc* sPageDesc = source->MakePageDesc(OUString("SourceStyle"));
+ SwPageDesc* tPageDesc = target->MakePageDesc(OUString("TargetStyle"));
+ //Enabling Mirror
+ sPageDesc->SetUseOn(nsUseOnPage::PD_MIRROR);
+ SwFrameFormat& sMasterFormat = sPageDesc->GetMaster();
+ //Setting horizontal spaces on master
+ SvxLRSpaceItem horizontalSpace(RES_LR_SPACE);
+ horizontalSpace.SetLeft(11);
+ horizontalSpace.SetRight(12);
+ sMasterFormat.SetFormatAttr(horizontalSpace);
+ //Setting vertical spaces on master
+ SvxULSpaceItem verticalSpace(RES_UL_SPACE);
+ verticalSpace.SetUpper(13);
+ verticalSpace.SetLower(14);
+ sMasterFormat.SetFormatAttr(verticalSpace);
+ //Changing the style and copying it to target
+ source->ChgPageDesc(OUString("SourceStyle"), *sPageDesc);
+ target->CopyPageDesc(*sPageDesc, *tPageDesc);
+ //Checking the set values on all Formats in target
+ SwFrameFormat& tMasterFormat = tPageDesc->GetMaster();
+ SwFrameFormat& tLeftFormat = tPageDesc->GetLeft();
+ SwFrameFormat& tFirstMasterFormat = tPageDesc->GetFirstMaster();
+ SwFrameFormat& tFirstLeftFormat = tPageDesc->GetFirstLeft();
+ //Checking horizontal spaces
+ const SvxLRSpaceItem hMasterFormatSpace = tMasterFormat.GetLRSpace();
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hMasterFormatSpace.GetLeft());
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hMasterFormatSpace.GetRight());
+ //mirror effect should be present
+ const SvxLRSpaceItem hLeftFormatSpace = tLeftFormat.GetLRSpace();
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hLeftFormatSpace.GetLeft());
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hLeftFormatSpace.GetRight());
+ const SvxLRSpaceItem hFirstMasterFormatSpace = tFirstMasterFormat.GetLRSpace();
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hFirstMasterFormatSpace.GetLeft());
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hFirstMasterFormatSpace.GetRight());
+ //mirror effect should be present
+ const SvxLRSpaceItem hFirstLeftFormatSpace = tFirstLeftFormat.GetLRSpace();
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetRight(), hFirstLeftFormatSpace.GetLeft());
+ CPPUNIT_ASSERT_EQUAL(horizontalSpace.GetLeft(), hFirstLeftFormatSpace.GetRight());
+ //Checking vertical spaces
+ const SvxULSpaceItem vMasterFormatSpace = tMasterFormat.GetULSpace();
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vMasterFormatSpace.GetUpper());
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vMasterFormatSpace.GetLower());
+ const SvxULSpaceItem vLeftFormatSpace = tLeftFormat.GetULSpace();
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vLeftFormatSpace.GetUpper());
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vLeftFormatSpace.GetLower());
+ const SvxULSpaceItem vFirstMasterFormatSpace = tFirstMasterFormat.GetULSpace();
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vFirstMasterFormatSpace.GetUpper());
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vFirstMasterFormatSpace.GetLower());
+ const SvxULSpaceItem vFirstLeftFormatSpace = tFirstLeftFormat.GetULSpace();
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetUpper(), vFirstLeftFormatSpace.GetUpper());
+ CPPUNIT_ASSERT_EQUAL(verticalSpace.GetLower(), vFirstLeftFormatSpace.GetLower());
+ xSourceDoc->dispose();
+}
+
void SwUiWriterTest::testSearchWithTransliterate()
{
SwDoc* pDoc = createDoc();
More information about the Libreoffice-commits
mailing list