Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
39dd9b64
Kaydet (Commit)
39dd9b64
authored
Şub 19, 2013
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
testcase for
349e9248
Change-Id: I27ca3b21427cb4d6e6b54ae5f0b3b86e18b550a2
üst
5fb8aa77
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
cell-btlr.docx
sw/qa/extras/ooxmlexport/data/cell-btlr.docx
+0
-0
ooxmlexport.cxx
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+62
-0
No files found.
sw/qa/extras/ooxmlexport/data/cell-btlr.docx
0 → 100644
Dosyayı görüntüle @
39dd9b64
File added
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Dosyayı görüntüle @
39dd9b64
...
@@ -41,8 +41,13 @@
...
@@ -41,8 +41,13 @@
#include <com/sun/star/text/XPageCursor.hpp>
#include <com/sun/star/text/XPageCursor.hpp>
#include <unotools/tempfile.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <rtl/strbuf.hxx>
#include <swmodeltestbase.hxx>
#include <swmodeltestbase.hxx>
#include <libxml/xpathInternals.h>
#include <libxml/parserInternals.h>
class
Test
:
public
SwModelTestBase
class
Test
:
public
SwModelTestBase
{
{
public
:
public
:
...
@@ -74,6 +79,7 @@ public:
...
@@ -74,6 +79,7 @@ public:
void
testTextFrames
();
void
testTextFrames
();
void
testTextFrameBorders
();
void
testTextFrameBorders
();
void
testTextframeGradient
();
void
testTextframeGradient
();
void
testCellBtlr
();
CPPUNIT_TEST_SUITE
(
Test
);
CPPUNIT_TEST_SUITE
(
Test
);
#if !defined(MACOSX) && !defined(WNT)
#if !defined(MACOSX) && !defined(WNT)
...
@@ -116,6 +122,7 @@ void Test::run()
...
@@ -116,6 +122,7 @@ void Test::run()
{
"textframes.odt"
,
&
Test
::
testTextFrames
},
{
"textframes.odt"
,
&
Test
::
testTextFrames
},
{
"textframe-borders.docx"
,
&
Test
::
testTextFrameBorders
},
{
"textframe-borders.docx"
,
&
Test
::
testTextFrameBorders
},
{
"textframe-gradient.docx"
,
&
Test
::
testTextframeGradient
},
{
"textframe-gradient.docx"
,
&
Test
::
testTextframeGradient
},
{
"cell-btlr.docx"
,
&
Test
::
testCellBtlr
},
};
};
// Don't test the first import of these, for some reason those tests fail
// Don't test the first import of these, for some reason those tests fail
const
char
*
aBlacklist
[]
=
{
const
char
*
aBlacklist
[]
=
{
...
@@ -564,6 +571,61 @@ void Test::testTextframeGradient()
...
@@ -564,6 +571,61 @@ void Test::testTextframeGradient()
CPPUNIT_ASSERT_EQUAL
(
awt
::
GradientStyle_AXIAL
,
aGradient
.
Style
);
CPPUNIT_ASSERT_EQUAL
(
awt
::
GradientStyle_AXIAL
,
aGradient
.
Style
);
}
}
void
Test
::
testCellBtlr
()
{
/*
* The problem was that the exporter didn't mirror the workaround of the
* importer, regarding the btLr text direction: the <w:textDirection
* w:val="btLr"/> token was completely missing in the output.
*
* Given that this doesn't affect the result in the importer, we test the
* resulting file directly, by opening the zip file, parsing an xml stream,
* and asserting an XPath expression. This can be extracted to a helper
* method, once it's clear what is common in such tests.
*/
// Create the zip file.
utl
::
TempFile
aTempFile
;
aTempFile
.
EnableKillingFile
();
uno
::
Reference
<
frame
::
XStorable
>
xStorable
(
mxComponent
,
uno
::
UNO_QUERY
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aFilterArgs
(
1
);
aFilterArgs
[
0
].
Name
=
"FilterName"
;
aFilterArgs
[
0
].
Value
<<=
OUString
(
"Office Open XML Text"
);
xStorable
->
storeToURL
(
aTempFile
.
GetURL
(),
aFilterArgs
);
// Read the XML stream we're interested in.
uno
::
Sequence
<
uno
::
Any
>
aArgs
(
1
);
aArgs
[
0
]
<<=
OUString
(
aTempFile
.
GetURL
());
uno
::
Reference
<
container
::
XNameAccess
>
xNameAccess
(
m_xSFactory
->
createInstanceWithArguments
(
"com.sun.star.packages.zip.ZipFileAccess"
,
aArgs
),
uno
::
UNO_QUERY
);
uno
::
Reference
<
io
::
XInputStream
>
xInputStream
(
xNameAccess
->
getByName
(
"word/document.xml"
),
uno
::
UNO_QUERY
);
boost
::
shared_ptr
<
SvStream
>
pStream
(
utl
::
UcbStreamHelper
::
CreateStream
(
xInputStream
,
sal_True
));
pStream
->
Seek
(
STREAM_SEEK_TO_END
);
sal_Size
nSize
=
pStream
->
Tell
();
pStream
->
Seek
(
0
);
OStringBuffer
aDocument
(
nSize
);
char
ch
;
for
(
sal_Size
i
=
0
;
i
<
nSize
;
++
i
)
{
*
pStream
>>
ch
;
aDocument
.
append
(
ch
);
}
// Parse the XML.
xmlDocPtr
pXmlDoc
=
xmlParseMemory
((
const
char
*
)
aDocument
.
getStr
(),
aDocument
.
getLength
());
// Assert the XPath expression.
xmlXPathContextPtr
pXmlXpathCtx
=
xmlXPathNewContext
(
pXmlDoc
);
xmlXPathRegisterNs
(
pXmlXpathCtx
,
BAD_CAST
(
"w"
),
BAD_CAST
(
"http://schemas.openxmlformats.org/wordprocessingml/2006/main"
));
OString
aXPath
=
"/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:textDirection"
;
xmlXPathObjectPtr
pXmlXpathObj
=
xmlXPathEvalExpression
(
BAD_CAST
(
aXPath
.
getStr
()),
pXmlXpathCtx
);
xmlNodeSetPtr
pXmlNodes
=
pXmlXpathObj
->
nodesetval
;
CPPUNIT_ASSERT_EQUAL
(
1
,
xmlXPathNodeSetGetLength
(
pXmlNodes
));
xmlNodePtr
pXmlNode
=
pXmlNodes
->
nodeTab
[
0
];
OString
aAttribute
=
"val"
;
OUString
aValue
=
OUString
::
createFromAscii
((
const
char
*
)
xmlGetProp
(
pXmlNode
,
BAD_CAST
(
aAttribute
.
getStr
())));
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"btLr"
),
aValue
);
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
CPPUNIT_PLUGIN_IMPLEMENT
();
CPPUNIT_PLUGIN_IMPLEMENT
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment