[Libreoffice-commits] .: sw/qa sw/source

2012-04-24 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/fdo38176.rtf |3 +++
 sw/qa/extras/rtfexport/rtfexport.cxx |   30 ++
 sw/source/filter/ww8/rtfexport.cxx   |3 ++-
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit ef7cc64d8b5044251d6e31ca24aeb0ac11818e5d
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Apr 24 12:47:16 2012 +0200

fdo#38176 fix RTF export of non-breaking space

diff --git a/sw/qa/extras/rtfexport/data/fdo38176.rtf 
b/sw/qa/extras/rtfexport/data/fdo38176.rtf
new file mode 100644
index 000..c5126e4
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo38176.rtf
@@ -0,0 +1,3 @@
+{\rtf1
+foo\~bar
+\par}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 642544d..607a39a 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -26,6 +26,7 @@
  */
 
 #include com/sun/star/frame/XStorable.hpp
+#include com/sun/star/text/XTextDocument.hpp
 #include com/sun/star/view/XViewSettingsSupplier.hpp
 
 #include test/bootstrapfixture.hxx
@@ -44,15 +45,19 @@ public:
 virtual void setUp();
 virtual void tearDown();
 void testZoom();
+void testFdo38176();
 
 CPPUNIT_TEST_SUITE(RtfExportTest);
 #if !defined(MACOSX)  !defined(WNT)
 CPPUNIT_TEST(testZoom);
+CPPUNIT_TEST(testFdo38176);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
 private:
 void roundtrip(const OUString rURL);
+/// Get the length of the whole document.
+int getLength();
 uno::Referencelang::XComponent mxComponent;
 };
 
@@ -69,6 +74,25 @@ void RtfExportTest::roundtrip(const OUString rFilename)
 mxComponent = loadFromDesktop(aTempFile.GetURL());
 }
 
+int RtfExportTest::getLength()
+{
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
+OUStringBuffer aBuf;
+while (xParaEnum-hasMoreElements())
+{
+uno::Referencecontainer::XEnumerationAccess 
xRangeEnumAccess(xParaEnum-nextElement(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xRangeEnum = 
xRangeEnumAccess-createEnumeration();
+while (xRangeEnum-hasMoreElements())
+{
+uno::Referencetext::XTextRange xRange(xRangeEnum-nextElement(), 
uno::UNO_QUERY);
+aBuf.append(xRange-getString());
+}
+}
+return aBuf.getLength();
+}
+
 void RtfExportTest::setUp()
 {
 test::BootstrapFixture::setUp();
@@ -97,6 +121,12 @@ void RtfExportTest::testZoom()
 CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
 }
 
+void RtfExportTest::testFdo38176()
+{
+roundtrip(fdo38176.rtf);
+CPPUNIT_ASSERT_EQUAL(7, getLength());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index d5a90ad..15eec5e 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -924,7 +924,8 @@ OString RtfExport::OutChar(sal_Unicode c, int *pUCMode, 
rtl_TextEncoding eDestEn
 }
 if (pStr) {
 aBuf.append(pStr);
-aBuf.append(' ');
+if (c != 0xa0)
+aBuf.append(' ');
 }
 return aBuf.makeStringAndClear();
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa sw/source

2012-04-24 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/fdo38176.rtf |2 +-
 sw/qa/extras/rtfexport/rtfexport.cxx |2 +-
 sw/source/filter/ww8/rtfexport.cxx   |   11 +--
 3 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit dfc7c67e464e57f5442365e193c56033af564d84
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Apr 24 13:05:12 2012 +0200

fdo#38176 fix RTF export of non-breaking hyphen and optional hyphen

diff --git a/sw/qa/extras/rtfexport/data/fdo38176.rtf 
b/sw/qa/extras/rtfexport/data/fdo38176.rtf
index c5126e4..baa4193 100644
--- a/sw/qa/extras/rtfexport/data/fdo38176.rtf
+++ b/sw/qa/extras/rtfexport/data/fdo38176.rtf
@@ -1,3 +1,3 @@
 {\rtf1
-foo\~bar
+foo\~\_\-bar
 \par}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 607a39a..5bab469 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -124,7 +124,7 @@ void RtfExportTest::testZoom()
 void RtfExportTest::testFdo38176()
 {
 roundtrip(fdo38176.rtf);
-CPPUNIT_ASSERT_EQUAL(7, getLength());
+CPPUNIT_ASSERT_EQUAL(9, getLength());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfExportTest);
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 15eec5e..8101125 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -924,8 +924,15 @@ OString RtfExport::OutChar(sal_Unicode c, int *pUCMode, 
rtl_TextEncoding eDestEn
 }
 if (pStr) {
 aBuf.append(pStr);
-if (c != 0xa0)
-aBuf.append(' ');
+switch (c)
+{
+case 0xa0:
+case 0x1e:
+case 0x1f:
+break;
+default:
+aBuf.append(' ');
+}
 }
 return aBuf.makeStringAndClear();
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa writerfilter/source

2012-04-21 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo48876.rtf  |5 +
 sw/qa/extras/rtftok/rtftok.cxx |   17 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   10 --
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 99b875aee04a808fb28715fb0e143a2b00332832
Author: Miklos Vajna vmik...@suse.cz
Date:   Sat Apr 21 12:53:22 2012 +0200

fdo#48876 fix RTF import of \sl without \slmult

diff --git a/sw/qa/extras/rtftok/data/fdo48876.rtf 
b/sw/qa/extras/rtftok/data/fdo48876.rtf
new file mode 100644
index 000..49a6eb0
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo48876.rtf
@@ -0,0 +1,5 @@
+{\rtf
+\sl54
+C
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 6870f02..0bb45e4 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -29,6 +29,8 @@
 #include com/sun/star/drawing/XDrawPageSupplier.hpp
 #include com/sun/star/lang/XServiceInfo.hpp
 #include com/sun/star/style/CaseMap.hpp
+#include com/sun/star/style/LineSpacing.hpp
+#include com/sun/star/style/LineSpacingMode.hpp
 #include com/sun/star/style/XStyleFamiliesSupplier.hpp
 #include com/sun/star/table/BorderLine2.hpp
 #include com/sun/star/table/BorderLineStyle.hpp
@@ -83,6 +85,7 @@ public:
 void testFdo39053();
 void testFdo48356();
 void testFdo48023();
+void testFdo48876();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -108,6 +111,7 @@ public:
 CPPUNIT_TEST(testFdo39053);
 CPPUNIT_TEST(testFdo48356);
 CPPUNIT_TEST(testFdo48023);
+CPPUNIT_TEST(testFdo48876);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -599,6 +603,19 @@ void RtfModelTest::testFdo48023()
 CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange-getString());
 }
 
+void RtfModelTest::testFdo48876()
+{
+load(fdo48876.rtf);
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
+CPPUNIT_ASSERT(xParaEnum-hasMoreElements());
+uno::Referencebeans::XPropertySet xPropertySet(xParaEnum-nextElement(), 
uno::UNO_QUERY);
+style::LineSpacing aSpacing;
+xPropertySet-getPropertyValue(ParaLineSpacing) = aSpacing;
+CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, aSpacing.Mode);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e50cc1f..750e473 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2379,9 +2379,15 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
 }
 break;
 case RTF_SL:
-if (nParam  0)
 {
-// NS_sprm::LN_PDyaLine could be used, but that won't work 
with slmult
+// This is similar to RTF_ABSH, negative value means 'exact', 
positive means 'at least'.
+RTFValue::Pointer_t pValue(new 
RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_atLeast));
+if (nParam  0)
+{
+pValue.reset(new 
RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_exact));
+pIntValue.reset(new RTFValue(-nParam));
+}
+
m_aStates.top().aParagraphAttributes-push_back(make_pair(NS_ooxml::LN_CT_Spacing_lineRule,
 pValue));
 
m_aStates.top().aParagraphAttributes-push_back(make_pair(NS_ooxml::LN_CT_Spacing_line,
 pIntValue));
 }
 break;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa writerfilter/source

2012-04-14 Thread Miklos Vajna
 sw/qa/extras/ooxmltok/data/n750935.docx |binary
 sw/qa/extras/ooxmltok/ooxmltok.cxx  |   14 ++
 writerfilter/source/dmapper/PropertyMap.cxx |   11 +--
 3 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 0ef7dbcb365534c4203760c86d089d50f7eb9562
Author: Miklos Vajna vmik...@suse.cz
Date:   Sat Apr 14 16:11:46 2012 +0200

dmapper: fix import of odd/even page breaks

diff --git a/sw/qa/extras/ooxmltok/data/n750935.docx 
b/sw/qa/extras/ooxmltok/data/n750935.docx
new file mode 100644
index 000..0dd0159
Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n750935.docx differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx 
b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 5beb577..5aff21c 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -31,7 +31,9 @@
 #include com/sun/star/text/SetVariableType.hpp
 #include com/sun/star/text/TextContentAnchorType.hpp
 #include com/sun/star/text/XDependentTextField.hpp
+#include com/sun/star/text/XPageCursor.hpp
 #include com/sun/star/text/XTextFieldsSupplier.hpp
+#include com/sun/star/text/XTextViewCursorSupplier.hpp
 
 #include test/bootstrapfixture.hxx
 #include unotest/macros_test.hxx
@@ -50,12 +52,14 @@ public:
 void testN751054();
 void testN751117();
 void testN751017();
+void testN750935();
 
 CPPUNIT_TEST_SUITE(OoxmlModelTest);
 #if !defined(MACOSX)  !defined(WNT)
 CPPUNIT_TEST(testN751054);
 CPPUNIT_TEST(testN751117);
 CPPUNIT_TEST(testN751017);
+CPPUNIT_TEST(testN750935);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -171,6 +175,16 @@ void OoxmlModelTest::testN751017()
 CPPUNIT_ASSERT(bFoundGet);
 }
 
+void OoxmlModelTest::testN750935()
+{
+load(n750935.docx);
+uno::Referenceframe::XModel xModel(mxComponent, uno::UNO_QUERY);
+uno::Referencetext::XTextViewCursorSupplier 
xTextViewCursorSupplier(xModel-getCurrentController(), uno::UNO_QUERY);
+uno::Referencetext::XPageCursor 
xCursor(xTextViewCursorSupplier-getViewCursor(), uno::UNO_QUERY);
+xCursor-jumpToLastPage();
+CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor-getPage());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(OoxmlModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 471f9b8..3f6b18c 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -39,6 +39,7 @@
 #include com/sun/star/container/XEnumerationAccess.hpp
 #include com/sun/star/container/XNameContainer.hpp
 #include com/sun/star/style/BreakType.hpp
+#include com/sun/star/style/PageStyleLayout.hpp
 #include com/sun/star/text/RelOrientation.hpp
 #include com/sun/star/text/WritingMode.hpp
 #include com/sun/star/text/XTextColumns.hpp
@@ -974,8 +975,14 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl rDM_Impl )
 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd 
page */
 xRangeProperties-setPropertyValue(rPropNameSupplier.GetName( 
PROP_PAGE_DESC_NAME ),
 uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : 
m_sFollowPageStyleName ));
-//  todo: page breaks with odd/even page numbering are not available - 
find out current page number to check how to change the number
-//  or add even/odd page break types
+// handle page breaks with odd/even page numbering
+style::PageStyleLayout nPageStyleLayout;
+if (m_nBreakType == 3)
+nPageStyleLayout = style::PageStyleLayout_LEFT;
+else if (m_nBreakType == 4)
+nPageStyleLayout = style::PageStyleLayout_RIGHT;
+if (nPageStyleLayout)
+xFollowPageStyle-setPropertyValue(PageStyleLayout, 
uno::makeAny(nPageStyleLayout));
 if(m_bPageNoRestart || m_nPageNumber = 0)
 {
 sal_Int16 nPageNumber = m_nPageNumber = 0 ? static_cast 
sal_Int16 (m_nPageNumber) : 1;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-04-06 Thread Miklos Vajna
 sw/qa/extras/ooxmltok/data/n751017.docx |binary
 sw/qa/extras/ooxmltok/ooxmltok.cxx  |   52 
 2 files changed, 52 insertions(+)

New commits:
commit 46e7e5a505ddc2933316ba1d42895155a26e8b67
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Apr 6 16:55:34 2012 +0200

n#751017 testcase

diff --git a/sw/qa/extras/ooxmltok/data/n751017.docx 
b/sw/qa/extras/ooxmltok/data/n751017.docx
new file mode 100644
index 000..cdd81cf
Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n751017.docx differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx 
b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 364d66d..5beb577 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -28,7 +28,10 @@
 #include com/sun/star/beans/XPropertySet.hpp
 #include com/sun/star/drawing/XDrawPageSupplier.hpp
 #include com/sun/star/lang/XServiceInfo.hpp
+#include com/sun/star/text/SetVariableType.hpp
 #include com/sun/star/text/TextContentAnchorType.hpp
+#include com/sun/star/text/XDependentTextField.hpp
+#include com/sun/star/text/XTextFieldsSupplier.hpp
 
 #include test/bootstrapfixture.hxx
 #include unotest/macros_test.hxx
@@ -46,11 +49,13 @@ public:
 virtual void tearDown();
 void testN751054();
 void testN751117();
+void testN751017();
 
 CPPUNIT_TEST_SUITE(OoxmlModelTest);
 #if !defined(MACOSX)  !defined(WNT)
 CPPUNIT_TEST(testN751054);
 CPPUNIT_TEST(testN751117);
+CPPUNIT_TEST(testN751017);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -119,6 +124,53 @@ void OoxmlModelTest::testN751117()
 
CPPUNIT_ASSERT(xServiceInfo-supportsService(com.sun.star.drawing.LineShape));
 }
 
+void OoxmlModelTest::testN751017()
+{
+load(n751017.docx);
+uno::Referencetext::XTextFieldsSupplier xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess 
xMasters(xTextFieldsSupplier-getTextFieldMasters());
+// Make sure we have a variable named foo.
+
CPPUNIT_ASSERT(xMasters-hasByName(com.sun.star.text.FieldMaster.SetExpression.foo));
+
+uno::Referencecontainer::XEnumerationAccess 
xFieldsAccess(xTextFieldsSupplier-getTextFields());
+uno::Referencecontainer::XEnumeration 
xFields(xFieldsAccess-createEnumeration());
+bool bFoundSet(false), bFoundGet(false);
+while (xFields-hasMoreElements())
+{
+uno::Referencelang::XServiceInfo 
xServiceInfo(xFields-nextElement(), uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet xPropertySet(xServiceInfo, 
uno::UNO_QUERY);
+sal_Int16 nValue = 0;
+OUString aValue;
+if 
(xServiceInfo-supportsService(com.sun.star.text.TextField.SetExpression))
+{
+bFoundSet = true;
+uno::Referencetext::XDependentTextField 
xDependentTextField(xServiceInfo, uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet 
xMasterProps(xDependentTextField-getTextFieldMaster());
+
+// First step: did we set foo to bar?
+xMasterProps-getPropertyValue(Name) = aValue;
+CPPUNIT_ASSERT_EQUAL(OUString(foo), aValue);
+xPropertySet-getPropertyValue(SubType) = nValue;
+CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue);
+xPropertySet-getPropertyValue(Content) = aValue;
+CPPUNIT_ASSERT_EQUAL(OUString(bar), aValue);
+}
+else if 
(xServiceInfo-supportsService(com.sun.star.text.TextField.GetExpression))
+{
+// Second step: check the value of foo.
+bFoundGet = true;
+xPropertySet-getPropertyValue(Content) = aValue;
+CPPUNIT_ASSERT_EQUAL(OUString(foo), aValue);
+xPropertySet-getPropertyValue(SubType) = nValue;
+CPPUNIT_ASSERT_EQUAL(text::SetVariableType::STRING, nValue);
+xPropertySet-getPropertyValue(CurrentPresentation) = aValue;
+CPPUNIT_ASSERT_EQUAL(OUString(bar), aValue);
+}
+}
+CPPUNIT_ASSERT(bFoundSet);
+CPPUNIT_ASSERT(bFoundGet);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(OoxmlModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa writerfilter/source

2012-04-03 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo45182.rtf  |   11 +++
 sw/qa/extras/rtftok/rtftok.cxx |   15 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   17 +++--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 ++
 4 files changed, 43 insertions(+), 2 deletions(-)

New commits:
commit f4e0cbaa15c2861e87149a62c9c80a9e9b4094b3
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Apr 3 16:49:41 2012 +0200

fdo#45182 fix RTF import of character encoding in footnotes

There were two problems here:

1) \plain reset the character properties, but did not touch the current 
encoding
2) the default properties were not passed to substreams

diff --git a/sw/qa/extras/rtftok/data/fdo45182.rtf 
b/sw/qa/extras/rtftok/data/fdo45182.rtf
new file mode 100644
index 000..b076106
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo45182.rtf
@@ -0,0 +1,11 @@
+{\rtf1\deff0
+{\fonttbl
+{\f0\fcharset238
+Times New Roman;}
+}
+a\chftn 
+{\footnote 
+\ltrpar \pard\plain\'9eivnost\'ed
+\par
+}
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 45eabbf..9267967 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -35,6 +35,7 @@
 #include com/sun/star/text/RelOrientation.hpp
 #include com/sun/star/text/SizeType.hpp
 #include com/sun/star/text/TextContentAnchorType.hpp
+#include com/sun/star/text/XFootnotesSupplier.hpp
 #include com/sun/star/text/XPageCursor.hpp
 #include com/sun/star/text/XTextDocument.hpp
 #include com/sun/star/text/XTextGraphicObjectsSupplier.hpp
@@ -77,6 +78,7 @@ public:
 void testFdo45394();
 void testFdo48104();
 void testFdo47107();
+void testFdo45182();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -97,6 +99,7 @@ public:
 CPPUNIT_TEST(testFdo45394);
 CPPUNIT_TEST(testFdo48104);
 CPPUNIT_TEST(testFdo47107);
+CPPUNIT_TEST(testFdo45182);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -500,6 +503,18 @@ void RtfModelTest::testFdo47107()
 xNumberingStyles-getByName(WWNum2);
 }
 
+void RtfModelTest::testFdo45182()
+{
+load(fdo45182.rtf);
+
+uno::Referencetext::XFootnotesSupplier xFootnotesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xFootnotes(xFootnotesSupplier-getFootnotes(), uno::UNO_QUERY);
+uno::Referencetext::XTextRange xTextRange(xFootnotes-getByIndex(0), 
uno::UNO_QUERY);
+// Encoding in the footnote was wrong.
+OUString aExpected(živností, 10, RTL_TEXTENCODING_UTF8);
+CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange-getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5ceeaeb..e938f98 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -541,6 +541,14 @@ int RTFDocumentImpl::getFontIndex(int nIndex)
 return m_pSuperstream-getFontIndex(nIndex);
 }
 
+RTFParserState RTFDocumentImpl::getDefaultState()
+{
+if (!m_pSuperstream)
+return m_aDefaultState;
+else
+return m_pSuperstream-getDefaultState();
+}
+
 void RTFDocumentImpl::resolve(Stream  rMapper)
 {
 m_pMapperStream = rMapper;
@@ -1762,8 +1770,13 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252;
 break;
 case RTF_PLAIN:
-m_aStates.top().aCharacterSprms = m_aDefaultState.aCharacterSprms;
-m_aStates.top().aCharacterAttributes = 
m_aDefaultState.aCharacterAttributes;
+{
+m_aStates.top().aCharacterSprms = 
getDefaultState().aCharacterSprms;
+RTFValue::Pointer_t pValue = 
m_aStates.top().aCharacterSprms.find(NS_sprm::LN_CRgFtc0);
+if (pValue.get())
+m_aStates.top().nCurrentEncoding = 
getEncoding(pValue-getInt());
+m_aStates.top().aCharacterAttributes = 
getDefaultState().aCharacterAttributes;
+}
 break;
 case RTF_PARD:
 m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 1747958..1d72ece 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -372,6 +372,8 @@ namespace writerfilter {
 int getFontIndex(int nIndex);
 /// Return the encoding associated with a dmapper font index.
 rtl_TextEncoding getEncoding(sal_uInt32 nFontIndex);
+/// Get the default parser state.
+RTFParserState getDefaultState();
 
 private:
 SvStream Strm();
___

[Libreoffice-commits] .: sw/qa

2012-03-30 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo45394.rtf |   19 +++
 sw/qa/extras/rtftok/rtftok.cxx|   22 ++
 2 files changed, 41 insertions(+)

New commits:
commit 0827e813f9b5afcec393bad7894c4ec1954d88f1
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Mar 30 10:44:09 2012 +0200

testcase for fdo#45394

diff --git a/sw/qa/extras/rtftok/data/fdo45394.rtf 
b/sw/qa/extras/rtftok/data/fdo45394.rtf
new file mode 100644
index 000..6d02f50
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo45394.rtf
@@ -0,0 +1,19 @@
+{\rtf1
+{\fonttbl
+{\f37\fswiss\fcharset204\fprq2
+Verdana;}
+}
+{\headerr
+\f37 \'cf\'ca \'d0\'c8\'ca\par
+}
+\trowd \cellx4498\cellx9104
+\pard\plain\intbl
+\cell \cell
+\row
+\trowd \cellx4498\cellx9104
+\pard\plain\intbl
+c\cell d\cell
+\row
+\pard\plain
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 472e775..f13e15d 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -39,6 +39,7 @@
 #include com/sun/star/text/XTextDocument.hpp
 #include com/sun/star/text/XTextGraphicObjectsSupplier.hpp
 #include com/sun/star/text/XTextFramesSupplier.hpp
+#include com/sun/star/text/XTextTablesSupplier.hpp
 #include com/sun/star/text/XTextViewCursorSupplier.hpp
 
 #include rtl/oustringostreaminserter.hxx
@@ -73,6 +74,7 @@ public:
 void testFdo47326();
 void testFdo47036();
 void testFdo46955();
+void testFdo45394();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -90,6 +92,7 @@ public:
 CPPUNIT_TEST(testFdo47326);
 CPPUNIT_TEST(testFdo47036);
 CPPUNIT_TEST(testFdo46955);
+CPPUNIT_TEST(testFdo45394);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -449,6 +452,25 @@ void RtfModelTest::testFdo46955()
 }
 }
 
+void RtfModelTest::testFdo45394()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo45394.rtf)));
+
+uno::Referencestyle::XStyleFamiliesSupplier 
xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess 
xStyles(xStyleFamiliesSupplier-getStyleFamilies(), uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess 
xPageStyles(xStyles-getByName(PageStyles), uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet 
xPropertySet(xPageStyles-getByName(Default), uno::UNO_QUERY);
+uno::Referencetext::XText 
xHeaderText(xPropertySet-getPropertyValue(HeaderText), uno::UNO_QUERY);
+OUString aActual = xHeaderText-getString();
+// Encoding in the header was wrong.
+OUString aExpected(ПК РИК, 11, RTL_TEXTENCODING_UTF8);
+CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+
+uno::Referencetext::XTextTablesSupplier xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xIndexAccess(xTextTablesSupplier-getTextTables(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess-getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-03-28 Thread Miklos Vajna
 sw/qa/extras/ooxmltok/data/n751117.docx |binary
 sw/qa/extras/ooxmltok/ooxmltok.cxx  |   29 +
 2 files changed, 29 insertions(+)

New commits:
commit bbb03549db3ecb9e4e5a3c4c3cb58059c06ea7e8
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Mar 28 17:35:44 2012 +0200

add testcase for n#751117

diff --git a/sw/qa/extras/ooxmltok/data/n751117.docx 
b/sw/qa/extras/ooxmltok/data/n751117.docx
new file mode 100644
index 000..17cc9c5
Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n751117.docx differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx 
b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 32d39af..364d66d 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -27,6 +27,7 @@
 
 #include com/sun/star/beans/XPropertySet.hpp
 #include com/sun/star/drawing/XDrawPageSupplier.hpp
+#include com/sun/star/lang/XServiceInfo.hpp
 #include com/sun/star/text/TextContentAnchorType.hpp
 
 #include test/bootstrapfixture.hxx
@@ -44,10 +45,12 @@ public:
 virtual void setUp();
 virtual void tearDown();
 void testN751054();
+void testN751117();
 
 CPPUNIT_TEST_SUITE(OoxmlModelTest);
 #if !defined(MACOSX)  !defined(WNT)
 CPPUNIT_TEST(testN751054);
+CPPUNIT_TEST(testN751117);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -90,6 +93,32 @@ void OoxmlModelTest::testN751054()
 CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER);
 }
 
+void OoxmlModelTest::testN751117()
+{
+load(n751117.docx);
+
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY);
+
+// First shape: the end should be an arrow, should be rotated and should 
be flipped.
+uno::Referencebeans::XPropertySet xPropertySet(xDraws-getByIndex(0), 
uno::UNO_QUERY);
+OUString aValue;
+xPropertySet-getPropertyValue(LineEndName) = aValue;
+CPPUNIT_ASSERT(aValue.indexOf(Arrow) != -1);
+
+sal_Int32 nValue = 0;
+xPropertySet-getPropertyValue(RotateAngle) = nValue;
+CPPUNIT_ASSERT_EQUAL(sal_Int32(90 * 100), nValue);
+
+uno::Referencedrawing::XShape xShape(xPropertySet, uno::UNO_QUERY);
+awt::Size aActualSize(xShape-getSize());
+CPPUNIT_ASSERT(aActualSize.Width  0);
+
+// The second shape should be a line
+uno::Referencelang::XServiceInfo xServiceInfo(xDraws-getByIndex(1), 
uno::UNO_QUERY);
+
CPPUNIT_ASSERT(xServiceInfo-supportsService(com.sun.star.drawing.LineShape));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(OoxmlModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-03-25 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo46955.rtf |1 +
 sw/qa/extras/rtftok/rtftok.cxx|2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit da1a73fa0b3e5baf535333c0b344be2d3cb46e4f
Author: Miklos Vajna vmik...@suse.cz
Date:   Sun Mar 25 23:00:45 2012 +0200

rtftok: added missing test document

diff --git a/sw/qa/extras/rtftok/data/fdo46955.rtf 
b/sw/qa/extras/rtftok/data/fdo46955.rtf
new file mode 100644
index 000..4e3ddda
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo46955.rtf
@@ -0,0 +1 @@
+{\rtf1 \caps caps\par}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 59390a5..472e775 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -89,7 +89,7 @@ public:
 CPPUNIT_TEST(testN751020);
 CPPUNIT_TEST(testFdo47326);
 CPPUNIT_TEST(testFdo47036);
-//CPPUNIT_TEST(testFdo46955);
+CPPUNIT_TEST(testFdo46955);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa writerfilter/source

2012-03-24 Thread Miklos Vajna
 sw/qa/extras/rtftok/rtftok.cxx |   24 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 +
 2 files changed, 25 insertions(+)

New commits:
commit 04cae9ec1e1f04833b06fe9f24e23cfaf5265599
Author: Miklos Vajna vmik...@suse.cz
Date:   Sat Mar 24 17:14:12 2012 +0100

fdo#46955 fix RTF import of all capitals char prop

diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 0628268..472e775 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -28,6 +28,7 @@
 #include com/sun/star/beans/XPropertySet.hpp
 #include com/sun/star/drawing/XDrawPageSupplier.hpp
 #include com/sun/star/lang/XServiceInfo.hpp
+#include com/sun/star/style/CaseMap.hpp
 #include com/sun/star/style/XStyleFamiliesSupplier.hpp
 #include com/sun/star/table/BorderLine2.hpp
 #include com/sun/star/table/BorderLineStyle.hpp
@@ -71,6 +72,7 @@ public:
 void testN751020();
 void testFdo47326();
 void testFdo47036();
+void testFdo46955();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -87,6 +89,7 @@ public:
 CPPUNIT_TEST(testN751020);
 CPPUNIT_TEST(testFdo47326);
 CPPUNIT_TEST(testFdo47036);
+CPPUNIT_TEST(testFdo46955);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -425,6 +428,27 @@ void RtfModelTest::testFdo47036()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess-getCount());
 }
 
+void RtfModelTest::testFdo46955()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo46955.rtf)));
+
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
+while (xParaEnum-hasMoreElements())
+{
+uno::Referencecontainer::XEnumerationAccess 
xRangeEnumAccess(xParaEnum-nextElement(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xRangeEnum = 
xRangeEnumAccess-createEnumeration();
+while (xRangeEnum-hasMoreElements())
+{
+uno::Referencebeans::XPropertySet 
xPropertySet(xRangeEnum-nextElement(), uno::UNO_QUERY);
+sal_Int16 nValue;
+
xPropertySet-getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CharCaseMap)))
 = nValue;
+CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, nValue);
+}
+}
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e4d4e50..85f70f9 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2768,6 +2768,7 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, 
bool bParam, int nParam
 case RTF_STRIKED: nSprm = NS_sprm::LN_CFDStrike; break;
 case RTF_SCAPS: nSprm = NS_sprm::LN_CFSmallCaps; break;
 case RTF_IMPR: nSprm = NS_sprm::LN_CFImprint; break;
+case RTF_CAPS: nSprm = NS_sprm::LN_CFCaps; break;
 default: break;
 }
 if (nSprm = 0)
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa writerfilter/source

2012-03-23 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo47326.rtf  |5 +
 sw/qa/extras/rtftok/rtftok.cxx |9 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 
 3 files changed, 22 insertions(+)

New commits:
commit f84e0e6b1b0ec5f52ee963a62ac420cd872a771e
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Mar 23 12:47:41 2012 +0100

fdo#47326 fix RTF import of mixed super/nonsuper text

In most cases \super has its own group, but it's valid to have mixed
super and non-super text in a single group, as long as \super and
\nosupersub keywords are used: handle this.

diff --git a/sw/qa/extras/rtftok/data/fdo47326.rtf 
b/sw/qa/extras/rtftok/data/fdo47326.rtf
new file mode 100644
index 000..264e719
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo47326.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+Windows\super\'ae\nosupersub XP:
+\pard
+ Cartes:\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 7483634..f4a0c4d 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -68,6 +68,7 @@ public:
 void testFdo45563();
 void testFdo43965();
 void testN751020();
+void testFdo47326();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -82,6 +83,7 @@ public:
 CPPUNIT_TEST(testFdo45563);
 CPPUNIT_TEST(testFdo43965);
 CPPUNIT_TEST(testN751020);
+CPPUNIT_TEST(testFdo47326);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -389,6 +391,13 @@ void RtfModelTest::testN751020()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), nValue);
 }
 
+void RtfModelTest::testFdo47326()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo47326.rtf)));
+// This was 15 only, as \super buffered text, then the contents of it got 
lost.
+CPPUNIT_ASSERT_EQUAL(19, getLength());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 84267f3..d378694 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1932,6 +1932,14 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 
m_aStates.top().aCharacterSprms-push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign,
 pValue));
 }
 break;
+case RTF_NOSUPERSUB:
+if (m_pCurrentBuffer == m_aSuperBuffer)
+{
+replayBuffer(m_aSuperBuffer);
+m_pCurrentBuffer = 0;
+}
+
m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_EG_RPrBase_vertAlign);
+break;
 case RTF_LINEPPAGE:
 case RTF_LINECONT:
 {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-03-19 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/n751020.rtf |8 
 sw/qa/extras/rtftok/rtftok.cxx   |   15 +++
 2 files changed, 23 insertions(+)

New commits:
commit 9415e8c6c3089be3c4c78e3878163eda3e2bd873
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Mar 19 10:45:28 2012 +0100

testcase for n#751020

diff --git a/sw/qa/extras/rtftok/data/n751020.rtf 
b/sw/qa/extras/rtftok/data/n751020.rtf
new file mode 100644
index 000..66175cf
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/n751020.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+{\stylesheet
+{Normal;}
+}
+\linkstyles
+first\par
+second\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index c376779..7483634 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -67,6 +67,7 @@ public:
 void testN750757();
 void testFdo45563();
 void testFdo43965();
+void testN751020();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -80,6 +81,7 @@ public:
 CPPUNIT_TEST(testN750757);
 CPPUNIT_TEST(testFdo45563);
 CPPUNIT_TEST(testFdo43965);
+CPPUNIT_TEST(testN751020);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -374,6 +376,19 @@ void RtfModelTest::testFdo43965()
 CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor-getPage());
 }
 
+void RtfModelTest::testN751020()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(n751020.rtf)));
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
+CPPUNIT_ASSERT(xParaEnum-hasMoreElements());
+uno::Referencebeans::XPropertySet xPropertySet(xParaEnum-nextElement(), 
uno::UNO_QUERY);
+sal_Int32 nValue = 0;
+
xPropertySet-getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ParaBottomMargin)))
 = nValue;
+CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), nValue);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-03-13 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo45563.rtf |5 +
 sw/qa/extras/rtftok/rtftok.cxx|   17 +
 2 files changed, 22 insertions(+)

New commits:
commit e5823e8513eee31fd96549a4b0273063ed31b192
Author: Miklos Vajna vmik...@suse.cz
Date:   Tue Mar 13 10:16:27 2012 +0100

testcase for fdo#45563

diff --git a/sw/qa/extras/rtftok/data/fdo45563.rtf 
b/sw/qa/extras/rtftok/data/fdo45563.rtf
new file mode 100644
index 000..3dd3fd0
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo45563.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+only n\
+only r\
both r and n\
+last\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index c11af26..95fc51b 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -63,6 +63,7 @@ public:
 void testFdo45187();
 void testFdo46662();
 void testN750757();
+void testFdo45563();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -74,6 +75,7 @@ public:
 CPPUNIT_TEST(testFdo45187);
 CPPUNIT_TEST(testFdo46662);
 CPPUNIT_TEST(testN750757);
+CPPUNIT_TEST(testFdo45563);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -322,6 +324,21 @@ void RtfModelTest::testN750757()
 CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
 }
 
+void RtfModelTest::testFdo45563()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo45563.rtf)));
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
+int i = 0;
+while (xParaEnum-hasMoreElements())
+{
+xParaEnum-nextElement();
+i++;
+}
+CPPUNIT_ASSERT_EQUAL(4, i);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-03-05 Thread Michael Stahl
 sw/qa/complex/writer/CheckFields.java |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 72a3c7a2778c493ef1d3f740a0b4b14f805c624a
Author: Michael Stahl mst...@redhat.com
Date:   Mon Mar 5 12:32:39 2012 +0100

sw: CheckFields: oops, forgot to close the document

diff --git a/sw/qa/complex/writer/CheckFields.java 
b/sw/qa/complex/writer/CheckFields.java
index f966e52..00c6916 100644
--- a/sw/qa/complex/writer/CheckFields.java
+++ b/sw/qa/complex/writer/CheckFields.java
@@ -36,6 +36,7 @@ import com.sun.star.lang.XServiceInfo;
 import com.sun.star.beans.XPropertySet;
 import com.sun.star.beans.PropertyValue;
 import com.sun.star.container.XEnumeration;
+import com.sun.star.util.XCloseable;
 import com.sun.star.text.XText;
 import com.sun.star.text.XTextContent;
 import com.sun.star.text.XTextDocument;
@@ -138,6 +139,11 @@ public class CheckFields
 }
 }
 assertTrue(placeholders.isEmpty());
+XCloseable xClos = (XCloseable) UnoRuntime.queryInterface(
+XCloseable.class, xComp);
+if (xClos != null) {
+xClos.close(true);
+}
 }
 
 @Test
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-03-01 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo46662.rtf |   46 ++
 sw/qa/extras/rtftok/rtftok.cxx|   35 +
 2 files changed, 81 insertions(+)

New commits:
commit 7029ccec25bc0b15f9cea463ea3713e802eafc08
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Mar 1 11:38:47 2012 +0100

testcase for fdo#46662

diff --git a/sw/qa/extras/rtftok/data/fdo46662.rtf 
b/sw/qa/extras/rtftok/data/fdo46662.rtf
new file mode 100644
index 000..db93c9c
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo46662.rtf
@@ -0,0 +1,46 @@
+{\rtf1
+{\*\listtable
+{\list\listtemplateid3
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'01\'00;}
+{\levelnumbers\'01;}
+\fi-360\li720\lin720 }
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'03\'00.\'01;}
+{\levelnumbers\'01\'03;}
+\fi-360\li1080\lin1080 }
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'05\'00.\'01.\'02;}
+{\levelnumbers\'01\'03\'05;}
+\fi-360\li1440\lin1440 
+}
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'07\'00.\'01.\'02.\'03;}
+{\levelnumbers\'01\'03\'05\'07;}
+\fi-360\li1800\lin1800 }
+\listid3}
+}
+{\*\listoverridetable
+{\listoverride\listid3\listoverridecount0\ls3}
+}
+\pard\ls3
+{numbering with all sublevels: test 1
+\par 
+}
+\pard\ls3\ilvl1
+{test 1.1
+\par 
+}
+\pard\ls3\ilvl2
+{test 1.1.1
+\par 
+}
+\pard\ls3\ilvl3
+{test 1.1.1.1
+\par
+}
+\pard\ls3
+{test 2
+\par
+}
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 0e4a31b..1174626 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -28,6 +28,7 @@
 #include com/sun/star/beans/XPropertySet.hpp
 #include com/sun/star/drawing/XDrawPageSupplier.hpp
 #include com/sun/star/lang/XServiceInfo.hpp
+#include com/sun/star/style/XStyleFamiliesSupplier.hpp
 #include com/sun/star/table/BorderLine2.hpp
 #include com/sun/star/table/BorderLineStyle.hpp
 #include com/sun/star/text/RelOrientation.hpp
@@ -60,6 +61,7 @@ public:
 void testN695479();
 void testFdo42465();
 void testFdo45187();
+void testFdo46662();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -69,6 +71,7 @@ public:
 CPPUNIT_TEST(testN695479);
 CPPUNIT_TEST(testFdo42465);
 CPPUNIT_TEST(testFdo45187);
+CPPUNIT_TEST(testFdo46662);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -266,6 +269,38 @@ void RtfModelTest::testFdo45187()
 CPPUNIT_ASSERT(aFirstPoint.Y != aSecondPoint.Y);
 }
 
+void RtfModelTest::testFdo46662()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo46662.rtf)));
+
+uno::Referencestyle::XStyleFamiliesSupplier 
xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess 
xStyles(xStyleFamiliesSupplier-getStyleFamilies(), uno::UNO_QUERY);
+uno::Referencecontainer::XNameAccess 
xNumberingStyles(xStyles-getByName(OUString(RTL_CONSTASCII_USTRINGPARAM(NumberingStyles))),
 uno::UNO_QUERY);
+uno::Referencebeans::XPropertySet 
xPropertySet(xNumberingStyles-getByName(OUString(RTL_CONSTASCII_USTRINGPARAM(WWNum3))),
 uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xLevels(xPropertySet-getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(NumberingRules))),
 uno::UNO_QUERY);
+uno::Any aValue = xLevels-getByIndex(1); // 2nd level
+uno::Sequencebeans::PropertyValue aProps;
+aValue = aProps;
+
+for (int i = 0; i  aProps.getLength(); ++i)
+{
+const beans::PropertyValue rProp = aProps[i];
+
+if 
(rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(ParentNumbering)))
+{
+sal_Int16 nValue;
+rProp.Value = nValue;
+CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nValue);
+}
+else if (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(Suffix)))
+{
+rtl::OUString sValue;
+rProp.Value = sValue;
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), sValue.getLength());
+}
+}
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-02-27 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo45187.rtf |   32 
 sw/qa/extras/rtftok/rtftok.cxx|   22 ++
 2 files changed, 54 insertions(+)

New commits:
commit bb4ceaa4bbe253f4d6b22b09098de0f2f0b793c8
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Feb 27 11:19:38 2012 +0100

add testcase for fdo#45187

diff --git a/sw/qa/extras/rtftok/data/fdo45187.rtf 
b/sw/qa/extras/rtftok/data/fdo45187.rtf
new file mode 100644
index 000..61b71ad
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo45187.rtf
@@ -0,0 +1,32 @@
+{\rtf1
+{\field
+{\*\fldinst SHAPE }
+{\fldrslt
+{\shp
+{\*\shpinst\shpleft1000\shptop1000\shpright2000\shpbottom2000
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+}
+}
+}
+}
+first
+\par
+{\field
+{\*\fldinst SHAPE }
+{\fldrslt
+{\shp
+{\*\shpinst\shpleft1000\shptop3000\shpright2000\shpbottom4000
+{\sp
+{\sn shapeType}
+{\sv 3}
+}
+}
+}
+}
+}
+second
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 92c3229..0e4a31b 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -59,6 +59,7 @@ public:
 void testFdo45543();
 void testN695479();
 void testFdo42465();
+void testFdo45187();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -67,6 +68,7 @@ public:
 CPPUNIT_TEST(testFdo45543);
 CPPUNIT_TEST(testN695479);
 CPPUNIT_TEST(testFdo42465);
+CPPUNIT_TEST(testFdo45187);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -244,6 +246,26 @@ void RtfModelTest::testFdo42465()
 CPPUNIT_ASSERT_EQUAL(3, getLength());
 }
 
+void RtfModelTest::testFdo45187()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo45187.rtf)));
+
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY);
+// There should be two shapes.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws-getCount());
+// They should be anchored to different paragraphs.
+uno::Referencebeans::XPropertySet xPropertySet(xDraws-getByIndex(0), 
uno::UNO_QUERY);
+uno::Any aValue = 
xPropertySet-getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(AnchorPosition)));
+awt::Point aFirstPoint;
+aValue = aFirstPoint;
+xPropertySet.set(xDraws-getByIndex(1), uno::UNO_QUERY);
+aValue = 
xPropertySet-getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(AnchorPosition)));
+awt::Point aSecondPoint;
+aValue = aSecondPoint;
+CPPUNIT_ASSERT(aFirstPoint.Y != aSecondPoint.Y);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-02-22 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo42465.rtf |4 ++
 sw/qa/extras/rtftok/rtftok.cxx|   47 ++
 2 files changed, 35 insertions(+), 16 deletions(-)

New commits:
commit 938ddf379004d9696a005ed612994576e2d7cca0
Author: Miklos Vajna vmik...@suse.cz
Date:   Wed Feb 22 17:53:03 2012 +0100

testcase for fdo#42465

diff --git a/sw/qa/extras/rtftok/data/fdo42465.rtf 
b/sw/qa/extras/rtftok/data/fdo42465.rtf
new file mode 100644
index 000..06c29d4
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo42465.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+{\langfe1038\dbch\af14\afs24\alang1025\rtlch \ltrch\loch\fs24\lang1038\loch\f7
+k\uc2 \u243\'c3\'b3d\uc1 }
+\par }
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index eb64e0a..92c3229 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -58,6 +58,7 @@ public:
 void testN192129();
 void testFdo45543();
 void testN695479();
+void testFdo42465();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
@@ -65,11 +66,15 @@ public:
 CPPUNIT_TEST(testN192129);
 CPPUNIT_TEST(testFdo45543);
 CPPUNIT_TEST(testN695479);
+CPPUNIT_TEST(testFdo42465);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
 private:
+/// Load an RTF file and make the document available via mxComponent.
 void load(const OUString rURL);
+/// Get the length of the whole document.
+int getLength();
 uno::Referencelang::XComponent mxComponent;
 };
 
@@ -78,6 +83,25 @@ void RtfModelTest::load(const OUString rFilename)
 mxComponent = loadFromDesktop(getURLFromSrc(/sw/qa/extras/rtftok/data/) 
+ rFilename);
 }
 
+int RtfModelTest::getLength()
+{
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
+OUStringBuffer aBuf;
+while (xParaEnum-hasMoreElements())
+{
+uno::Referencecontainer::XEnumerationAccess 
xRangeEnumAccess(xParaEnum-nextElement(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xRangeEnum = 
xRangeEnumAccess-createEnumeration();
+while (xRangeEnum-hasMoreElements())
+{
+uno::Referencetext::XTextRange xRange(xRangeEnum-nextElement(), 
uno::UNO_QUERY);
+aBuf.append(xRange-getString());
+}
+}
+return aBuf.getLength();
+}
+
 void RtfModelTest::setUp()
 {
 test::BootstrapFixture::setUp();
@@ -150,22 +174,7 @@ void RtfModelTest::testN192129()
 void RtfModelTest::testFdo45543()
 {
 load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo45543.rtf)));
-
-uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
-uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
-uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
-OUStringBuffer aBuf;
-while (xParaEnum-hasMoreElements())
-{
-uno::Referencecontainer::XEnumerationAccess 
xRangeEnumAccess(xParaEnum-nextElement(), uno::UNO_QUERY);
-uno::Referencecontainer::XEnumeration xRangeEnum = 
xRangeEnumAccess-createEnumeration();
-while (xRangeEnum-hasMoreElements())
-{
-uno::Referencetext::XTextRange xRange(xRangeEnum-nextElement(), 
uno::UNO_QUERY);
-aBuf.append(xRange-getString());
-}
-}
-CPPUNIT_ASSERT_EQUAL((sal_Int32)5, aBuf.getLength());
+CPPUNIT_ASSERT_EQUAL(5, getLength());
 }
 
 void RtfModelTest::testN695479()
@@ -229,6 +238,12 @@ void RtfModelTest::testN695479()
 CPPUNIT_ASSERT(bDrawFound);
 }
 
+void RtfModelTest::testFdo42465()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo42465.rtf)));
+CPPUNIT_ASSERT_EQUAL(3, getLength());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-02-14 Thread Tor Lillqvist
 sw/qa/extras/rtftok/rtftok.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 49a4b4c32bda86b97ef48d1d2ce9bf8f02d3e2e3
Author: Tor Lillqvist tlillqv...@suse.com
Date:   Tue Feb 14 10:55:50 2012 +0200

Fix int/sal_Int32 ambiguity

diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index df2966f..9afb4f2 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -156,7 +156,7 @@ void RtfModelTest::testFdo45543()
 aBuf.append(xRange-getString());
 }
 }
-CPPUNIT_ASSERT_EQUAL(5, aBuf.getLength());
+CPPUNIT_ASSERT_EQUAL((sal_Int32)5, aBuf.getLength());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2012-02-13 Thread Miklos Vajna
 sw/qa/extras/rtftok/data/fdo45543.rtf |8 
 sw/qa/extras/rtftok/rtftok.cxx|   23 +++
 2 files changed, 31 insertions(+)

New commits:
commit c26d9befbab1f60b5b8c191c883569eae3d08c2d
Author: Miklos Vajna vmik...@suse.cz
Date:   Mon Feb 13 21:54:18 2012 +0100

testcase for fdo#45543

diff --git a/sw/qa/extras/rtftok/data/fdo45543.rtf 
b/sw/qa/extras/rtftok/data/fdo45543.rtf
new file mode 100644
index 000..43a8c89
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo45543.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+{\fonttbl
+{\fdbminor\f31505\fbidi \froman\fcharset128\fprq1\'82\'6c\'82\'72 
\'96\'be\'92\'a9;}
+}
+\pard\plain
+\f31505 \'82\'b1\'82\'cc\'95\'b6\'8f\'91\'82\'cd
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 2c2252e..df2966f 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -49,11 +49,13 @@ public:
 virtual void tearDown();
 void testFdo45553();
 void testN192129();
+void testFdo45543();
 
 CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX)  !defined(WNT)
 CPPUNIT_TEST(testFdo45553);
 CPPUNIT_TEST(testN192129);
+CPPUNIT_TEST(testFdo45543);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -136,6 +138,27 @@ void RtfModelTest::testN192129()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), 
aActualSize.Height);
 }
 
+void RtfModelTest::testFdo45543()
+{
+load(OUString(RTL_CONSTASCII_USTRINGPARAM(fdo45543.rtf)));
+
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XEnumerationAccess 
xParaEnumAccess(xTextDocument-getText(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xParaEnum = 
xParaEnumAccess-createEnumeration();
+OUStringBuffer aBuf;
+while (xParaEnum-hasMoreElements())
+{
+uno::Referencecontainer::XEnumerationAccess 
xRangeEnumAccess(xParaEnum-nextElement(), uno::UNO_QUERY);
+uno::Referencecontainer::XEnumeration xRangeEnum = 
xRangeEnumAccess-createEnumeration();
+while (xRangeEnum-hasMoreElements())
+{
+uno::Referencetext::XTextRange xRange(xRangeEnum-nextElement(), 
uno::UNO_QUERY);
+aBuf.append(xRange-getString());
+}
+}
+CPPUNIT_ASSERT_EQUAL(5, aBuf.getLength());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2011-11-14 Thread Bjoern Michaelsen
 sw/qa/complex/writer/CheckBookmarks.java |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit fe7026d72b1b88f60e009fd4de2f53306e0d1c4e
Author: Bjoern Michaelsen bjoern.michael...@canonical.com
Date:   Mon Nov 14 23:03:23 2011 +0100

fdo#40819, i#116193: disable WW8 roundtrip as it breaks on big bookmark 
counts

diff --git a/sw/qa/complex/writer/CheckBookmarks.java 
b/sw/qa/complex/writer/CheckBookmarks.java
index 405ca0d..c922da2 100644
--- a/sw/qa/complex/writer/CheckBookmarks.java
+++ b/sw/qa/complex/writer/CheckBookmarks.java
@@ -107,9 +107,8 @@ public class CheckBookmarks {
 result.m_nDeleteRandomHash = new 
BigInteger(-3ec87e810b46d734677c351ad893bbbf9ea10f55,16);
 result.m_nLinebreakHash = new 
BigInteger(3ae08c284ea0d6e738cb43c0a8105e718a633550,16);
 result.m_nOdfReloadHash = new 
BigInteger(3ae08c284ea0d6e738cb43c0a8105e718a633550,16);
-// MsWord Hash changed from DEV300m41 = behaviour change, possible 
regression?
+// MsWord Hash is unstable over different systems
// result.m_nMsWordReloadHash = new 
BigInteger(3ae08c284ea0d6e738cb43c0a8105e718a633550,16);
-   result.m_nMsWordReloadHash = new 
BigInteger(-53193413016049203700369483764549874348805475606,10);
 return result;
 }
 
@@ -136,14 +135,14 @@ public class CheckBookmarks {
 actualHashes.m_nLinebreakHash = 
BookmarkHashes.getBookmarksHash(m_xDoc);
 m_xOdfReloadedDoc = reloadFrom(StarOffice XML (Writer), odf);
 actualHashes.m_nOdfReloadHash = 
BookmarkHashes.getBookmarksHash(m_xOdfReloadedDoc);
-m_xMsWordReloadedDoc = reloadFrom(MS Word 97, doc);
-actualHashes.m_nMsWordReloadHash = 
BookmarkHashes.getBookmarksHash(m_xMsWordReloadedDoc);
+//m_xMsWordReloadedDoc = reloadFrom(MS Word 97, doc);
+//actualHashes.m_nMsWordReloadHash = 
BookmarkHashes.getBookmarksHash(m_xMsWordReloadedDoc);
 }
 
 @After public void tearDownDocuments() {
 util.DesktopTools.closeDoc(m_xDoc);
 util.DesktopTools.closeDoc(m_xOdfReloadedDoc);
-util.DesktopTools.closeDoc(m_xMsWordReloadedDoc);
+//util.DesktopTools.closeDoc(m_xMsWordReloadedDoc);
 }
 
 @BeforeClass public static void setUpConnection() throws Exception {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2011-11-14 Thread Markus Mohrhard
 dev/null|binary
 sw/qa/core/data/doc/testVba.doc |binary
 2 files changed

New commits:
commit b197bac71a6111c3d024f5a3ee7863b833396689
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue Nov 15 00:29:50 2011 +0100

test file needs to be in doc and not in xls

diff --git a/sw/qa/core/data/doc/testVba.doc b/sw/qa/core/data/doc/testVba.doc
new file mode 100644
index 000..e8c87c6
Binary files /dev/null and b/sw/qa/core/data/doc/testVba.doc differ
diff --git a/sw/qa/core/data/xls/testVba.doc b/sw/qa/core/data/xls/testVba.doc
deleted file mode 100644
index e8c87c6..000
Binary files a/sw/qa/core/data/xls/testVba.doc and /dev/null differ
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2011-11-14 Thread Markus Mohrhard
 sw/qa/core/macros-test.cxx |   17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

New commits:
commit fe8c3c69fd784af9df56706c0026b4a09aed1a2d
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue Nov 15 02:39:34 2011 +0100

 we don't need to inherit from FiltersTest here

diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 10e83bc..d4ddbca 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -58,14 +58,11 @@ using namespace ::com::sun::star::uno;
 
 /* Implementation of Macros test */
 
-class SwMacrosTest
-: public test::FiltersTest
-, public test::BootstrapFixture
+class SwMacrosTest : public test::BootstrapFixture
 {
 public:
 SwMacrosTest();
 
-virtual bool load(const rtl::OUString rFilter, const rtl::OUString rURL, 
const rtl::OUString rUserData);
 SwDocShellRef load(const rtl::OUString rFilter, const rtl::OUString rURL,
 const rtl::OUString rUserData, const rtl::OUString rTypeName, 
sal_uLong nFormatType=0);
 uno::Reference com::sun::star::lang::XComponent  loadFromDesktop(const 
rtl::OUString rURL);
@@ -108,18 +105,6 @@ uno::Reference com::sun::star::lang::XComponent  
SwMacrosTest::loadFromDesktop
 return xComponent;
 }
 
-
-bool SwMacrosTest::load(const rtl::OUString rFilter, const rtl::OUString 
rURL,
-const rtl::OUString rUserData)
-{
-SwDocShellRef xDocShRef;
-bool bLoaded = xDocShRef.Is();
-//reference counting of SwDocShellRef is very confused.
-if (bLoaded)
-xDocShRef-DoClose();
-return bLoaded;
-}
-
 void SwMacrosTest::createFileURL(const rtl::OUString aFileBase, const 
rtl::OUString aFileExtension, rtl::OUString rFilePath)
 {
 rtl::OUString aSep(RTL_CONSTASCII_USTRINGPARAM(/));
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sw/qa

2011-11-10 Thread Markus Mohrhard
 sw/qa/core/filters-test.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit f596995c14c3360d4b7080f92f91515d6f473bd4
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Fri Nov 11 04:37:53 2011 +0100

SfxObjectShell takes ownership of SfxMedium and SfxFilter

diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 22923cc..c8e7d07 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -71,15 +71,15 @@ private:
 bool SwFiltersTest::load(const rtl::OUString rFilter, const rtl::OUString 
rURL,
 const rtl::OUString rUserData)
 {
-SfxFilter aFilter(
+SfxFilter* pFilter = new SfxFilter(
 rFilter,
 rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
 rUserData, rtl::OUString() );
 
 SwDocShellRef xDocShRef = new SwDocShell;
-SfxMedium aSrcMed(rURL, STREAM_STD_READ, true);
-aSrcMed.SetFilter(aFilter);
-bool bLoaded = xDocShRef-DoLoad(aSrcMed);
+SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ, true);
+pSrcMed-SetFilter(pFilter);
+bool bLoaded = xDocShRef-DoLoad(pSrcMed);
 if (xDocShRef.Is())
 xDocShRef-DoClose();
 return bLoaded;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits