Kaydet (Commit) 0bd57d62 authored tarafından Jens Carl's avatar Jens Carl Kaydeden (comit) Markus Mohrhard

tdf#45904 Move Java _XViewSplitable tests to C++

Change-Id: Ib9cf1c53947d10260673e1e1088bbfbaa30efbc9
Reviewed-on: https://gerrit.libreoffice.org/40801Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 855af7f3
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/.
*/
#ifndef INCLUDED_TEST_SHEET_XVIEWSPLITABLE_HXX
#define INCLUDED_TEST_SHEET_XVIEWSPLITABLE_HXX
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx>
using namespace css;
using namespace css::uno;
namespace apitest {
class OOO_DLLPUBLIC_TEST XViewSplitable
{
public:
virtual uno::Reference< uno::XInterface > init() = 0;
virtual ~XViewSplitable(){}
void testSplit();
};
}
#endif // INCLUDED_TEST_SHEET_XVIEWSPLITABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -653,7 +653,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XUniqueCellFormatRangesSupplier \
qadevOOo/tests/java/ifc/sheet/_XUsedAreaCursor \
qadevOOo/tests/java/ifc/sheet/_XViewFreezable \
qadevOOo/tests/java/ifc/sheet/_XViewSplitable \
qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesComplex \
......
......@@ -39,12 +39,6 @@
"ScTabViewObj";"com::sun::star::sheet::XViewFreezable";"freezeAtPosition()"
"ScTabViewObj";"com::sun::star::sheet::XActivationBroadcaster#optional";"addActivationEventListener()"
"ScTabViewObj";"com::sun::star::sheet::XActivationBroadcaster#optional";"removeActivationEventListener()"
"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getIsWindowSplit()"
"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getSplitHorizontal()"
"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getSplitVertical()"
"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getSplitColumn()"
"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"getSplitRow()"
"ScTabViewObj";"com::sun::star::sheet::XViewSplitable";"splitAtPosition()"
"ScTabViewObj";"com::sun::star::sheet::XRangeSelection";"startRangeSelection()"
"ScTabViewObj";"com::sun::star::sheet::XRangeSelection";"abortRangeSelection()"
"ScTabViewObj";"com::sun::star::sheet::XRangeSelection";"addRangeSelectionListener()"
......
/*
* 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package ifc.sheet;
import lib.MultiMethodTest;
import com.sun.star.sheet.XViewSplitable;
/**
* Testing <code>com.sun.star.sheet.XViewSplitable</code>
* interface methods :
* <ul>
* <li><code> getIsWindowSplit()</code></li>
* <li><code> getSplitHorizontal()</code></li>
* <li><code> getSplitVertical()</code></li>
* <li><code> getSplitColumn()</code></li>
* <li><code> getSplitRow()</code></li>
* <li><code> splitAtPosition()</code></li>
* </ul> <p>
* @see com.sun.star.sheet.XViewSplitable
*/
public class _XViewSplitable extends MultiMethodTest {
public XViewSplitable oObj = null;
protected static final int posX = 101, posY = 51;
/**
* Test just calls the method. <p>
* Has <b> OK </b> status if the method successfully returns. <p>
*/
public void _splitAtPosition(){
oObj.splitAtPosition(posX, posY);
tRes.tested("splitAtPosition()", true);
}
/**
* Test calls the method and checks returned value. <p>
* Has <b> OK </b> status if returned value is equal to true. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> splitAtPosition() </code> : that the view was splitted into
* individual panes </li>
* </ul>
*/
public void _getIsWindowSplit(){
requiredMethod("splitAtPosition()");
tRes.tested("getIsWindowSplit()", oObj.getIsWindowSplit());
}
/**
* Test calls the method and compares returned value with value that was
* set by method <code>splitAtPosition()</code>. <p>
* Has <b> OK </b> status if returned value is equal to value that was
* set by method <code>splitAtPosition()</code>. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> splitAtPosition() </code> : to split the view at the
* specified position </li>
* </ul>
*/
public void _getSplitHorizontal() {
requiredMethod("splitAtPosition()");
tRes.tested("getSplitHorizontal()", oObj.getSplitHorizontal() == posX);
}
/**
* Test calls the method and compares returned value with value that was
* set by method <code>splitAtPosition()</code>. <p>
* Has <b> OK </b> status if returned value is equal to value that was
* set by method <code>splitAtPosition()</code>. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> splitAtPosition() </code> : to split the view at the
* specified position </li>
* </ul>
*/
public void _getSplitVertical() {
requiredMethod("splitAtPosition()");
tRes.tested("getSplitVertical()", oObj.getSplitVertical() == posY);
}
/**
* Test calls the method and checks returned value. <p>
* Has <b> OK </b> status if returned value isn't equal zero. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> splitAtPosition() </code> : to split the view at the
* specified position </li>
* </ul>
*/
public void _getSplitColumn() {
requiredMethod("splitAtPosition()");
tRes.tested("getSplitColumn()", oObj.getSplitColumn() != 0);
}
/**
* Test calls the method and checks returned value. <p>
* Has <b> OK </b> status if returned value isn't equal zero. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> splitAtPosition() </code> : to split the view at the
* specified position </li>
* </ul>
*/
public void _getSplitRow() {
requiredMethod("splitAtPosition()");
tRes.tested("getSplitRow()", oObj.getSplitRow() != 0);
}
} // finish class _XViewSplitable
# -*- 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_tabviewobj))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_tabviewobj, \
sc/qa/extras/sctabviewobj \
))
$(eval $(call gb_CppunitTest_use_external,sc_tabviewobj,boost_headers))
$(eval $(call gb_CppunitTest_use_libraries,sc_tabviewobj, \
basegfx \
comphelper \
cppu \
cppuhelper \
drawinglayer \
editeng \
for \
forui \
i18nlangtag \
msfilter \
oox \
sal \
salhelper \
sax \
sb \
sc \
sfx \
sot \
subsequenttest \
svl \
svt \
svx \
svxcore \
test \
tk \
tl \
ucbhelper \
unotest \
utl \
vbahelper \
vcl \
xo \
))
$(eval $(call gb_CppunitTest_set_include,sc_tabviewobj,\
-I$(SRCDIR)/sc/source/ui/inc \
-I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_tabviewobj))
$(eval $(call gb_CppunitTest_use_ure,sc_tabviewobj))
$(eval $(call gb_CppunitTest_use_vcl,sc_tabviewobj))
$(eval $(call gb_CppunitTest_use_components,sc_tabviewobj,\
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 \
uui/util/uui \
xmloff/util/xo \
svtools/util/svt \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_tabviewobj))
# vim: set noet sw=4 ts=4:
......@@ -122,6 +122,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_viewpaneobj \
CppunitTest_sc_cellobj \
CppunitTest_sc_cellcursorobj \
CppunitTest_sc_tabviewobj \
))
$(eval $(call gb_Module_add_perfcheck_targets,sc,\
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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 <test/sheet/xviewsplitable.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XViewSplitable.hpp>
#include <com/sun/star/uno/XInterface.hpp>
using namespace css;
using namespace css::uno;
namespace sc_apitest {
#define NUMBER_OF_TESTS 1
class ScTabViewObj : public CalcUnoApiTest, public apitest::XViewSplitable
{
public:
ScTabViewObj();
virtual uno::Reference< uno::XInterface > init() override;
virtual void setUp() override;
virtual void tearDown() override;
CPPUNIT_TEST_SUITE(ScTabViewObj);
// XViewSplitable
CPPUNIT_TEST(testSplit);
CPPUNIT_TEST_SUITE_END();
private:
static sal_Int32 nTest;
static uno::Reference< lang::XComponent > mxComponent;
};
sal_Int32 ScTabViewObj::nTest = 0;
uno::Reference< lang::XComponent > ScTabViewObj::mxComponent;
ScTabViewObj::ScTabViewObj()
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
{
}
uno::Reference< uno::XInterface > ScTabViewObj::init()
{
if (!mxComponent.is())
mxComponent = loadFromDesktop("private:factory/scalc");
uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("no calc document", xSheetDoc.is());
uno::Reference< frame::XModel > xModel(xSheetDoc, uno::UNO_QUERY_THROW);
uno::Reference< sheet::XViewSplitable > xViewSplitable(xModel->getCurrentController(), uno::UNO_QUERY_THROW);
return xViewSplitable;
}
void ScTabViewObj::setUp()
{
nTest++;
CalcUnoApiTest::setUp();
}
void ScTabViewObj::tearDown()
{
if (nTest == NUMBER_OF_TESTS)
{
closeDocument(mxComponent);
mxComponent.clear();
}
CalcUnoApiTest::tearDown();
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTabViewObj);
} // end namespace
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -67,6 +67,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xsheetoutline \
test/source/sheet/xstyleloader \
test/source/sheet/xviewpane \
test/source/sheet/xviewsplitable \
test/source/text/xtext \
test/source/text/xtextfield \
test/source/text/xtextcontent \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/sheet/xviewsplitable.hxx>
#include <com/sun/star/sheet/XViewSplitable.hpp>
#include "cppunit/extensions/HelperMacros.h"
using namespace com::sun::star;
using namespace com::sun::star::uno;
namespace apitest {
void XViewSplitable::testSplit()
{
uno::Reference< sheet::XViewSplitable > xViewSplitable(init(), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("View is already split", !xViewSplitable->getIsWindowSplit());
xViewSplitable->splitAtPosition(101, 51);
CPPUNIT_ASSERT_MESSAGE("View wasn't split", xViewSplitable->getIsWindowSplit());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong horizontal pixel position",
sal_Int32(101), xViewSplitable->getSplitHorizontal());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong vertical pixel position",
sal_Int32(51), xViewSplitable->getSplitVertical());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong column",
sal_Int32(1), xViewSplitable->getSplitColumn());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong row",
sal_Int32(3), xViewSplitable->getSplitRow());
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment