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
a48c22e1
Kaydet (Commit)
a48c22e1
authored
Ock 12, 2017
tarafından
David Tardon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add test for handling .wk3 format file
Change-Id: Id6fd1f979902e286009d16f9d8ea551df3940859
üst
69c03000
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
166 additions
and
4 deletions
+166
-4
CppunitTest_writerperfect_import.mk
writerperfect/CppunitTest_writerperfect_import.mk
+40
-0
Module_writerperfect.mk
writerperfect/Module_writerperfect.mk
+1
-0
ImportTest.cxx
writerperfect/qa/unit/ImportTest.cxx
+118
-0
WpftFilterFixture.cxx
writerperfect/qa/unit/WpftFilterFixture.cxx
+2
-2
WpftFilterFixture.hxx
writerperfect/qa/unit/WpftFilterFixture.hxx
+5
-0
WpftLoader.hxx
writerperfect/qa/unit/WpftLoader.hxx
+0
-2
SOLVE.FM3
writerperfect/qa/unit/data/import/SOLVE.FM3
+0
-0
SOLVE.WK3
writerperfect/qa/unit/data/import/SOLVE.WK3
+0
-0
No files found.
writerperfect/CppunitTest_writerperfect_import.mk
0 → 100644
Dosyayı görüntüle @
a48c22e1
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_CppunitTest_CppunitTest,writerperfect_import))
$(eval $(call gb_CppunitTest_add_defs,writerperfect_import,\
-DTEST_DIR=\"writerperfect/qa/unit/data/import\" \
))
$(eval $(call gb_CppunitTest_use_sdk_api,writerperfect_import))
$(eval $(call gb_CppunitTest_use_libraries,writerperfect_import,\
comphelper \
cppu \
sal \
test \
unotest \
utl \
wpftqahelper \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_use_ure,writerperfect_import))
$(eval $(call gb_CppunitTest_use_vcl,writerperfect_import))
$(eval $(call gb_CppunitTest_use_rdb,writerperfect_import,services))
$(eval $(call gb_CppunitTest_use_configuration,writerperfect_import))
$(eval $(call gb_CppunitTest_add_exception_objects,writerperfect_import,\
writerperfect/qa/unit/ImportTest \
))
# vim: set noet sw=4 ts=4:
writerperfect/Module_writerperfect.mk
Dosyayı görüntüle @
a48c22e1
...
...
@@ -39,6 +39,7 @@ $(eval $(call gb_Module_add_check_targets,writerperfect,\
$(eval $(call gb_Module_add_slowcheck_targets,writerperfect,\
CppunitTest_writerperfect_calc \
CppunitTest_writerperfect_draw \
CppunitTest_writerperfect_import \
CppunitTest_writerperfect_impress \
CppunitTest_writerperfect_writer \
Library_wpftqahelper \
...
...
writerperfect/qa/unit/ImportTest.cxx
0 → 100644
Dosyayı görüntüle @
a48c22e1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/table/XCellRange.hpp>
#include <unotools/mediadescriptor.hxx>
#include "WpftFilterFixture.hxx"
#include "WpftLoader.hxx"
namespace
{
namespace
beans
=
css
::
beans
;
namespace
container
=
css
::
container
;
namespace
document
=
css
::
document
;
namespace
lang
=
css
::
lang
;
namespace
sheet
=
css
::
sheet
;
namespace
table
=
css
::
table
;
namespace
uno
=
css
::
uno
;
using
uno
::
UNO_QUERY
;
using
writerperfect
::
test
::
WpftLoader
;
class
ImportTest
:
public
writerperfect
::
test
::
WpftFilterFixture
{
public
:
virtual
void
setUp
()
override
;
void
testWK3WithFM3
();
CPPUNIT_TEST_SUITE
(
ImportTest
);
CPPUNIT_TEST
(
testWK3WithFM3
);
CPPUNIT_TEST_SUITE_END
();
private
:
WpftLoader
createCalcLoader
(
const
rtl
::
OUString
&
rFile
)
const
;
WpftLoader
createLoader
(
const
rtl
::
OUString
&
rUrl
,
const
rtl
::
OUString
&
rFactoryUrl
)
const
;
rtl
::
OUString
makeUrl
(
const
rtl
::
OUString
&
rFile
)
const
;
private
:
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
m_xFilterFactory
;
};
void
ImportTest
::
setUp
()
{
writerperfect
::
test
::
WpftFilterFixture
::
setUp
();
m_xFilterFactory
.
set
(
m_xFactory
->
createInstanceWithContext
(
"com.sun.star.document.FilterFactory"
,
m_xContext
),
UNO_QUERY
);
assert
(
m_xFilterFactory
.
is
());
}
void
ImportTest
::
testWK3WithFM3
()
{
WpftLoader
aLoader
(
createCalcLoader
(
"SOLVE.WK3"
));
uno
::
Reference
<
sheet
::
XSpreadsheetDocument
>
xDoc
(
aLoader
.
getDocument
(),
UNO_QUERY
);
CPPUNIT_ASSERT
(
xDoc
.
is
());
uno
::
Reference
<
container
::
XIndexAccess
>
xSheets
(
xDoc
->
getSheets
(),
UNO_QUERY
);
CPPUNIT_ASSERT
(
xSheets
.
is
());
uno
::
Reference
<
table
::
XCellRange
>
xSheet
(
xSheets
->
getByIndex
(
0
),
UNO_QUERY
);
CPPUNIT_ASSERT
(
xSheet
.
is
());
uno
::
Reference
<
beans
::
XPropertySet
>
xCellProps
(
xSheet
->
getCellByPosition
(
1
,
1
),
UNO_QUERY
);
CPPUNIT_ASSERT
(
xCellProps
.
is
());
sal_Int32
nCharColor
=
0
;
CPPUNIT_ASSERT
(
xCellProps
->
getPropertyValue
(
"CharColor"
)
>>=
nCharColor
);
#if 0 // broken by commit 8154953add163554c00935486a1cf5677cef2609
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x0000ff), nCharColor); // blue text
#endif
}
WpftLoader
ImportTest
::
createCalcLoader
(
const
rtl
::
OUString
&
rFile
)
const
{
return
createLoader
(
makeUrl
(
rFile
),
"private:factory/scalc"
);
}
WpftLoader
ImportTest
::
createLoader
(
const
rtl
::
OUString
&
rUrl
,
const
rtl
::
OUString
&
rFactoryUrl
)
const
{
utl
::
MediaDescriptor
aDesc
;
aDesc
[
utl
::
MediaDescriptor
::
PROP_URL
()]
<<=
rUrl
;
aDesc
[
utl
::
MediaDescriptor
::
PROP_READONLY
()]
<<=
true
;
uno
::
Sequence
<
beans
::
PropertyValue
>
lDesc
(
aDesc
.
getAsConstPropertyValueList
());
const
rtl
::
OUString
sType
=
m_xTypeDetection
->
queryTypeByDescriptor
(
lDesc
,
true
);
CPPUNIT_ASSERT
(
!
sType
.
isEmpty
());
const
uno
::
Reference
<
document
::
XFilter
>
xFilter
(
m_xFilterFactory
->
createInstance
(
sType
),
UNO_QUERY
);
CPPUNIT_ASSERT
(
xFilter
.
is
());
return
WpftLoader
(
rUrl
,
xFilter
,
rFactoryUrl
,
m_xDesktop
,
m_xTypeMap
,
m_xContext
);
}
rtl
::
OUString
ImportTest
::
makeUrl
(
const
rtl
::
OUString
&
rFile
)
const
{
return
const_cast
<
ImportTest
*>
(
this
)
->
m_directories
.
getURLFromSrc
(
"/"
TEST_DIR
"/"
+
rFile
);
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
ImportTest
);
}
CPPUNIT_PLUGIN_IMPLEMENT
();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
writerperfect/qa/unit/WpftFilterFixture.cxx
Dosyayı görüntüle @
a48c22e1
...
...
@@ -28,10 +28,10 @@ void WpftFilterFixture::setUp()
m_xDesktop
=
frame
::
theDesktop
::
get
(
m_xContext
);
const
uno
::
Reference
<
document
::
XTypeDetection
>
xTypeDetection
(
m_xTypeDetection
.
set
(
m_xFactory
->
createInstanceWithContext
(
"com.sun.star.document.TypeDetection"
,
m_xContext
),
uno
::
UNO_QUERY_THROW
);
m_xTypeMap
.
set
(
xTypeDetection
,
uno
::
UNO_QUERY_THROW
);
m_xTypeMap
.
set
(
m_
xTypeDetection
,
uno
::
UNO_QUERY_THROW
);
}
void
WpftFilterFixture
::
tearDown
()
...
...
writerperfect/qa/unit/WpftFilterFixture.hxx
Dosyayı görüntüle @
a48c22e1
...
...
@@ -52,6 +52,10 @@ namespace container
{
class
XNameAccess
;
}
namespace
document
{
class
XTypeDetection
;
}
namespace
frame
{
class
XDesktop2
;
...
...
@@ -73,6 +77,7 @@ public:
protected
:
css
::
uno
::
Reference
<
css
::
frame
::
XDesktop2
>
m_xDesktop
;
css
::
uno
::
Reference
<
css
::
document
::
XTypeDetection
>
m_xTypeDetection
;
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
m_xTypeMap
;
};
...
...
writerperfect/qa/unit/WpftLoader.hxx
Dosyayı görüntüle @
a48c22e1
...
...
@@ -68,8 +68,6 @@ public:
const
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
&
rxTypeMap
,
const
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
&
rxContext
);
WpftLoader
(
const
WpftLoader
&
)
=
delete
;
WpftLoader
&
operator
=
(
const
WpftLoader
&
)
=
delete
;
~
WpftLoader
();
const
css
::
uno
::
Reference
<
css
::
lang
::
XComponent
>
&
getDocument
()
const
;
...
...
writerperfect/qa/unit/data/import/SOLVE.FM3
0 → 100644
Dosyayı görüntüle @
a48c22e1
File added
writerperfect/qa/unit/data/import/SOLVE.WK3
0 → 100644
Dosyayı görüntüle @
a48c22e1
File added
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