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
2ca2b8c2
Kaydet (Commit)
2ca2b8c2
authored
Ara 22, 2014
tarafından
Matúš Kukan
Kaydeden (comit)
Markus Mohrhard
Ock 07, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
UNO API test for conditional formats
Change-Id: I45d4b9652f35174eaf59c8868d593764c2ef2ebf
üst
67c989ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
246 additions
and
0 deletions
+246
-0
CppunitTest_sc_condformats.mk
sc/CppunitTest_sc_condformats.mk
+109
-0
Module_sc.mk
sc/Module_sc.mk
+1
-0
sccondformats.cxx
sc/qa/extras/sccondformats.cxx
+136
-0
No files found.
sc/CppunitTest_sc_condformats.mk
0 → 100644
Dosyayı görüntüle @
2ca2b8c2
# -*- 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,sc_condformats))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_condformats, \
sc/qa/extras/sccondformats \
))
$(eval $(call gb_CppunitTest_use_external,sc_condformats,boost_headers))
$(eval $(call gb_CppunitTest_use_libraries,sc_condformats, \
basegfx \
comphelper \
cppu \
cppuhelper \
drawinglayer \
editeng \
for \
forui \
i18nlangtag \
msfilter \
oox \
sal \
salhelper \
sax \
sb \
sfx \
sot \
subsequenttest \
svl \
svt \
svx \
svxcore \
test \
tk \
tl \
ucbhelper \
unotest \
utl \
vbahelper \
vcl \
xo \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_set_include,sc_condformats,\
-I$(SRCDIR)/sc/source/ui/inc \
-I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sc_condformats,\
offapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_ure,sc_condformats))
$(eval $(call gb_CppunitTest_use_vcl,sc_condformats))
$(eval $(call gb_CppunitTest_use_components,sc_condformats,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
dbaccess/util/dba \
filter/source/config/cache/filterconfig1 \
filter/source/storagefilterdetect/storagefd \
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
sax/source/expatwrap/expwrap \
scripting/source/basprov/basprov \
scripting/util/scriptframe \
sc/util/sc \
sc/util/scd \
sc/util/scfilt \
$(call gb_Helper_optional,SCRIPTING, \
sc/util/vbaobj) \
sfx2/util/sfx \
sot/util/sot \
svl/source/fsstor/fsstorage \
toolkit/util/tk \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
ucb/source/ucp/tdoc/ucptdoc1 \
unotools/util/utl \
unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
xmloff/util/xo \
svtools/util/svt \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_condformats))
$(eval $(call gb_CppunitTest_use_unittest_configuration,sc_condformats))
# vim: set noet sw=4 ts=4:
sc/Module_sc.mk
Dosyayı görüntüle @
2ca2b8c2
...
...
@@ -51,6 +51,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
))
$(eval $(call gb_Module_add_slowcheck_targets,sc, \
CppunitTest_sc_condformats \
CppunitTest_sc_subsequent_filters_test \
CppunitTest_sc_subsequent_export_test \
CppunitTest_sc_html_export_test \
...
...
sc/qa/extras/sccondformats.cxx
0 → 100644
Dosyayı görüntüle @
2ca2b8c2
/* -*- 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 <test/calc_unoapi_test.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sheet/ConditionOperator.hpp>
#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <unonames.hxx>
using
namespace
css
;
namespace
sc_apitest
{
#define NUMBER_OF_TESTS 1
class
ScConditionalFormatTest
:
public
CalcUnoApiTest
{
public
:
ScConditionalFormatTest
();
virtual
void
setUp
()
SAL_OVERRIDE
;
virtual
void
tearDown
()
SAL_OVERRIDE
;
uno
::
Reference
<
uno
::
XInterface
>
init
();
void
testCondFormat
();
CPPUNIT_TEST_SUITE
(
ScConditionalFormatTest
);
CPPUNIT_TEST
(
testCondFormat
);
CPPUNIT_TEST_SUITE_END
();
private
:
static
sal_Int32
nTest
;
static
uno
::
Reference
<
lang
::
XComponent
>
mxComponent
;
};
sal_Int32
ScConditionalFormatTest
::
nTest
=
0
;
uno
::
Reference
<
lang
::
XComponent
>
ScConditionalFormatTest
::
mxComponent
;
ScConditionalFormatTest
::
ScConditionalFormatTest
()
:
CalcUnoApiTest
(
"sc/qa/unit/data/ods"
)
{
}
uno
::
Reference
<
uno
::
XInterface
>
ScConditionalFormatTest
::
init
()
{
// get the test file
OUString
aFileURL
;
createFileURL
(
OUString
(
"new_cond_format_test.ods"
),
aFileURL
);
if
(
!
mxComponent
.
is
())
mxComponent
=
loadFromDesktop
(
aFileURL
);
CPPUNIT_ASSERT_MESSAGE
(
"Component not loaded"
,
mxComponent
.
is
());
// get the first sheet
uno
::
Reference
<
sheet
::
XSpreadsheetDocument
>
xDoc
(
mxComponent
,
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
container
::
XIndexAccess
>
xIndex
(
xDoc
->
getSheets
(),
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
sheet
::
XSpreadsheet
>
xSheet
(
xIndex
->
getByIndex
(
0
),
uno
::
UNO_QUERY_THROW
);
return
xSheet
;
}
void
ScConditionalFormatTest
::
testCondFormat
()
{
uno
::
Reference
<
sheet
::
XSpreadsheet
>
aSheet
(
init
(),
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
beans
::
XPropertySet
>
xProps
;
uno
::
Reference
<
sheet
::
XSheetConditionalEntries
>
xSheetConditionalEntries
;
xProps
.
set
(
aSheet
->
getCellRangeByPosition
(
1
,
1
,
1
,
21
),
uno
::
UNO_QUERY_THROW
);
xSheetConditionalEntries
.
set
(
xProps
->
getPropertyValue
(
SC_UNONAME_CONDFMT
),
uno
::
UNO_QUERY_THROW
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
1
),
xSheetConditionalEntries
->
getCount
());
uno
::
Sequence
<
beans
::
PropertyValue
>
aPropertyValueList
(
5
);
aPropertyValueList
[
0
].
Name
=
SC_UNONAME_STYLENAME
;
aPropertyValueList
[
0
].
Value
<<=
uno
::
makeAny
<
OUString
>
(
"Result2"
);
aPropertyValueList
[
1
].
Name
=
SC_UNONAME_FORMULA1
;
aPropertyValueList
[
1
].
Value
<<=
uno
::
makeAny
<
OUString
>
(
"$Sheet1.$B$2"
);
aPropertyValueList
[
2
].
Name
=
SC_UNONAME_FORMULA2
;
aPropertyValueList
[
2
].
Value
<<=
uno
::
makeAny
<
OUString
>
(
"$Sheet1.$A$2"
);
aPropertyValueList
[
3
].
Name
=
SC_UNONAME_OPERATOR
;
aPropertyValueList
[
3
].
Value
<<=
sheet
::
ConditionOperator_EQUAL
;
aPropertyValueList
[
4
].
Name
=
SC_UNONAME_SOURCEPOS
;
aPropertyValueList
[
4
].
Value
<<=
uno
::
makeAny
(
table
::
CellAddress
(
0
,
0
,
16
));
xSheetConditionalEntries
->
addNew
(
aPropertyValueList
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
2
),
xSheetConditionalEntries
->
getCount
());
xProps
->
setPropertyValue
(
SC_UNONAME_CONDFMT
,
uno
::
makeAny
(
xSheetConditionalEntries
));
xProps
.
set
(
aSheet
->
getCellByPosition
(
0
,
16
),
uno
::
UNO_QUERY_THROW
);
xSheetConditionalEntries
.
set
(
xProps
->
getPropertyValue
(
SC_UNONAME_CONDFMT
),
uno
::
UNO_QUERY_THROW
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
xSheetConditionalEntries
->
getCount
());
// clear conditional formatting in cell $B$17
xProps
.
set
(
aSheet
->
getCellByPosition
(
1
,
16
),
uno
::
UNO_QUERY_THROW
);
xSheetConditionalEntries
.
set
(
xProps
->
getPropertyValue
(
SC_UNONAME_CONDFMT
),
uno
::
UNO_QUERY_THROW
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
2
),
xSheetConditionalEntries
->
getCount
());
xSheetConditionalEntries
->
clear
();
xProps
->
setPropertyValue
(
SC_UNONAME_CONDFMT
,
uno
::
makeAny
(
xSheetConditionalEntries
));
xProps
.
set
(
aSheet
->
getCellByPosition
(
1
,
16
),
uno
::
UNO_QUERY_THROW
);
xSheetConditionalEntries
.
set
(
xProps
->
getPropertyValue
(
SC_UNONAME_CONDFMT
),
uno
::
UNO_QUERY_THROW
);
// This was 1 before - conditional formats were not removed
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
xSheetConditionalEntries
->
getCount
());
}
void
ScConditionalFormatTest
::
setUp
()
{
nTest
++
;
CalcUnoApiTest
::
setUp
();
}
void
ScConditionalFormatTest
::
tearDown
()
{
if
(
nTest
==
NUMBER_OF_TESTS
)
{
closeDocument
(
mxComponent
);
mxComponent
.
clear
();
}
CalcUnoApiTest
::
tearDown
();
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
ScConditionalFormatTest
);
}
CPPUNIT_PLUGIN_IMPLEMENT
();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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