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
08dc5de9
Kaydet (Commit)
08dc5de9
authored
Şub 16, 2013
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#60842: add a unit test
Change-Id: Ie91fe22f2baf0a280e5cf21c2416228ab414f285
üst
40dc6c3a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
5 deletions
+45
-5
swmodeltestbase.hxx
sw/qa/extras/inc/swmodeltestbase.hxx
+33
-5
fdo60842.odt
sw/qa/extras/odfimport/data/fdo60842.odt
+0
-0
odfimport.cxx
sw/qa/extras/odfimport/odfimport.cxx
+12
-0
No files found.
sw/qa/extras/inc/swmodeltestbase.hxx
Dosyayı görüntüle @
08dc5de9
...
...
@@ -30,6 +30,8 @@
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/table/XCell.hpp>
#include <test/bootstrapfixture.hxx>
#include <unotest/macros_test.hxx>
...
...
@@ -196,7 +198,7 @@ protected:
}
// Get paragraph (counted from 1), optionally check it contains the given text.
uno
::
Reference
<
text
::
XTextRange
>
getParagraph
(
int
number
,
OUString
content
=
OUString
()
)
const
uno
::
Reference
<
text
::
XTextContent
>
getParagraphOrTable
(
int
number
)
const
{
uno
::
Reference
<
text
::
XTextDocument
>
textDocument
(
mxComponent
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
container
::
XEnumerationAccess
>
paraEnumAccess
(
textDocument
->
getText
(),
uno
::
UNO_QUERY
);
...
...
@@ -205,10 +207,18 @@ protected:
i
<
number
;
++
i
)
paraEnum
->
nextElement
();
uno
::
Reference
<
text
::
XTextRange
>
paragraph
(
paraEnum
->
nextElement
(),
uno
::
UNO_QUERY
);
uno
::
Reference
<
text
::
XTextContent
>
const
xElem
(
paraEnum
->
nextElement
(),
uno
::
UNO_QUERY_THROW
);
return
xElem
;
}
uno
::
Reference
<
text
::
XTextRange
>
getParagraph
(
int
number
,
OUString
content
=
OUString
()
)
const
{
uno
::
Reference
<
text
::
XTextRange
>
const
xParagraph
(
getParagraphOrTable
(
number
),
uno
::
UNO_QUERY_THROW
);
if
(
!
content
.
isEmpty
())
CPPUNIT_ASSERT_EQUAL
(
content
,
p
aragraph
->
getString
());
return
p
aragraph
;
CPPUNIT_ASSERT_EQUAL
(
content
,
xP
aragraph
->
getString
());
return
xP
aragraph
;
}
/// Get run (counted from 1) of a paragraph, optionally check it contains the given text.
...
...
@@ -233,6 +243,24 @@ protected:
return
getProperty
<
OUString
>
(
getProperty
<
uno
::
Reference
<
beans
::
XPropertySet
>
>
(
xFormula
,
"Model"
),
"Formula"
);
}
/// get cell of a table; table can be retrieved with getParagraphOrTable
uno
::
Reference
<
table
::
XCell
>
getCell
(
uno
::
Reference
<
uno
::
XInterface
>
const
&
xTableIfc
,
OUString
const
&
rCell
,
OUString
const
&
rContent
=
OUString
())
{
uno
::
Reference
<
text
::
XTextTable
>
const
xTable
(
xTableIfc
,
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
table
::
XCell
>
const
xCell
(
xTable
->
getCellByName
(
rCell
),
uno
::
UNO_SET_THROW
);
if
(
!
rContent
.
isEmpty
())
{
uno
::
Reference
<
text
::
XText
>
const
xCellText
(
xCell
,
uno
::
UNO_QUERY_THROW
);
CPPUNIT_ASSERT_EQUAL
(
rContent
,
xCellText
->
getString
());
}
return
xCell
;
}
void
header
()
{
fprintf
(
stderr
,
"File tested,Execution Time (ms)
\n
"
);
...
...
@@ -246,7 +274,7 @@ protected:
mxComponent
=
loadFromDesktop
(
getURLFromSrc
(
pDir
)
+
OUString
::
createFromAscii
(
pName
),
"com.sun.star.text.TextDocument"
);
calcLayout
();
}
void
reload
(
OUString
aFilter
)
{
uno
::
Reference
<
frame
::
XStorable
>
xStorable
(
mxComponent
,
uno
::
UNO_QUERY
);
...
...
sw/qa/extras/odfimport/data/fdo60842.odt
0 → 100644
Dosyayı görüntüle @
08dc5de9
File added
sw/qa/extras/odfimport/odfimport.cxx
Dosyayı görüntüle @
08dc5de9
...
...
@@ -42,6 +42,7 @@ public:
void
testOdtBorders
();
void
testPageStyleLayoutDefault
();
void
testPageStyleLayoutRight
();
void
testFdo60842
();
CPPUNIT_TEST_SUITE
(
Test
);
#if !defined(MACOSX) && !defined(WNT)
...
...
@@ -61,6 +62,7 @@ void Test::run()
{
"borders_ooo33.odt"
,
&
Test
::
testOdtBorders
},
{
"hello.odt"
,
&
Test
::
testPageStyleLayoutDefault
},
{
"hello.odt"
,
&
Test
::
testPageStyleLayoutRight
},
{
"fdo60842.odt"
,
&
Test
::
testFdo60842
},
};
header
();
for
(
unsigned
int
i
=
0
;
i
<
SAL_N_ELEMENTS
(
aMethods
);
++
i
)
...
...
@@ -291,6 +293,16 @@ void Test::testPageStyleLayoutRight()
xPropertySet
->
setPropertyValue
(
"PageStyleLayout"
,
uno
::
makeAny
(
style
::
PageStyleLayout_RIGHT
));
}
void
Test
::
testFdo60842
()
{
uno
::
Reference
<
text
::
XTextContent
>
const
xTable
(
getParagraphOrTable
(
0
));
getCell
(
xTable
,
"A1"
,
""
);
getCell
(
xTable
,
"B1"
,
"18/02/2012"
);
getCell
(
xTable
,
"C1"
,
"USD"
);
// this is the cell with office:string-value
getCell
(
xTable
,
"D1"
,
""
);
getCell
(
xTable
,
"E1"
,
"01/04/2012"
);
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
Test
);
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