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
078e8583
Kaydet (Commit)
078e8583
authored
Ock 15, 2013
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
clean up copy&paste tests duplication
Change-Id: Idc3e959ba701f9967f7bdb95bd920c8e7416c80a
üst
b6a2083b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
rtfimport.cxx
sw/qa/extras/rtfimport/rtfimport.cxx
+23
-27
No files found.
sw/qa/extras/rtfimport/rtfimport.cxx
Dosyayı görüntüle @
078e8583
...
...
@@ -148,6 +148,27 @@ private:
void
run
();
/// Get page count.
int
getPages
();
/// Copy&paste helper.
void
paste
(
OUString
aFilename
,
uno
::
Reference
<
text
::
XTextRange
>
xTextRange
=
uno
::
Reference
<
text
::
XTextRange
>
())
{
uno
::
Reference
<
document
::
XFilter
>
xFilter
(
m_xSFactory
->
createInstance
(
"com.sun.star.comp.Writer.RtfFilter"
),
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
document
::
XImporter
>
xImporter
(
xFilter
,
uno
::
UNO_QUERY_THROW
);
xImporter
->
setTargetDocument
(
mxComponent
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aDescriptor
(
xTextRange
.
is
()
?
3
:
2
);
aDescriptor
[
0
].
Name
=
"InputStream"
;
SvStream
*
pStream
=
utl
::
UcbStreamHelper
::
CreateStream
(
getURLFromSrc
(
"/sw/qa/extras/rtfimport/data/"
)
+
aFilename
,
STREAM_WRITE
);
uno
::
Reference
<
io
::
XStream
>
xStream
(
new
utl
::
OStreamWrapper
(
*
pStream
));
aDescriptor
[
0
].
Value
<<=
xStream
;
aDescriptor
[
1
].
Name
=
"IsNewDoc"
;
aDescriptor
[
1
].
Value
<<=
sal_False
;
if
(
xTextRange
.
is
())
{
aDescriptor
[
2
].
Name
=
"TextInsertModeRange"
;
aDescriptor
[
2
].
Value
<<=
xTextRange
;
}
xFilter
->
filter
(
aDescriptor
);
}
};
void
Test
::
run
()
...
...
@@ -849,18 +870,7 @@ void Test::testCopyPastePageStyle()
{
// The problem was that RTF import during copy&paste did not ignore page styles.
// Once we have more copy&paste tests, makes sense to refactor this to some helper method.
uno
::
Reference
<
uno
::
XInterface
>
xInterface
(
m_xSFactory
->
createInstance
(
"com.sun.star.comp.Writer.RtfFilter"
),
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
document
::
XImporter
>
xImporter
(
xInterface
,
uno
::
UNO_QUERY_THROW
);
xImporter
->
setTargetDocument
(
mxComponent
);
uno
::
Reference
<
document
::
XFilter
>
xFilter
(
xInterface
,
uno
::
UNO_QUERY_THROW
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aDescriptor
(
2
);
aDescriptor
[
0
].
Name
=
"InputStream"
;
SvStream
*
pStream
=
utl
::
UcbStreamHelper
::
CreateStream
(
getURLFromSrc
(
"/sw/qa/extras/rtfimport/data/"
)
+
"copypaste-pagestyle-paste.rtf"
,
STREAM_WRITE
);
uno
::
Reference
<
io
::
XStream
>
xStream
(
new
utl
::
OStreamWrapper
(
*
pStream
));
aDescriptor
[
0
].
Value
<<=
xStream
;
aDescriptor
[
1
].
Name
=
"IsNewDoc"
;
aDescriptor
[
1
].
Value
<<=
sal_False
;
xFilter
->
filter
(
aDescriptor
);
paste
(
"copypaste-pagestyle-paste.rtf"
);
uno
::
Reference
<
beans
::
XPropertySet
>
xPropertySet
(
getStyles
(
"PageStyles"
)
->
getByName
(
DEFAULT_STYLE
),
uno
::
UNO_QUERY
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
21001
),
getProperty
<
sal_Int32
>
(
xPropertySet
,
"Width"
));
// Was letter, i.e. 21590
...
...
@@ -872,21 +882,7 @@ void Test::testCopyPasteFootnote()
uno
::
Reference
<
text
::
XFootnotesSupplier
>
xFootnotesSupplier
(
mxComponent
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
container
::
XIndexAccess
>
xFootnotes
(
xFootnotesSupplier
->
getFootnotes
(),
uno
::
UNO_QUERY
);
uno
::
Reference
<
text
::
XTextRange
>
xTextRange
(
xFootnotes
->
getByIndex
(
0
),
uno
::
UNO_QUERY
);
uno
::
Reference
<
uno
::
XInterface
>
xInterface
(
m_xSFactory
->
createInstance
(
"com.sun.star.comp.Writer.RtfFilter"
),
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
document
::
XImporter
>
xImporter
(
xInterface
,
uno
::
UNO_QUERY_THROW
);
xImporter
->
setTargetDocument
(
mxComponent
);
uno
::
Reference
<
document
::
XFilter
>
xFilter
(
xInterface
,
uno
::
UNO_QUERY_THROW
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aDescriptor
(
3
);
aDescriptor
[
0
].
Name
=
"InputStream"
;
SvStream
*
pStream
=
utl
::
UcbStreamHelper
::
CreateStream
(
getURLFromSrc
(
"/sw/qa/extras/rtfimport/data/"
)
+
"copypaste-footnote-paste.rtf"
,
STREAM_WRITE
);
uno
::
Reference
<
io
::
XStream
>
xStream
(
new
utl
::
OStreamWrapper
(
*
pStream
));
aDescriptor
[
0
].
Value
<<=
xStream
;
aDescriptor
[
1
].
Name
=
"IsNewDoc"
;
aDescriptor
[
1
].
Value
<<=
sal_False
;
aDescriptor
[
2
].
Name
=
"TextInsertModeRange"
;
aDescriptor
[
2
].
Value
<<=
xTextRange
;
xFilter
->
filter
(
aDescriptor
);
paste
(
"copypaste-footnote-paste.rtf"
,
xTextRange
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"bbb"
),
xTextRange
->
getString
());
}
...
...
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