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

tdf#45904 Move Java _XViewFreezable tests to C++

Change-Id: I75a0363304dbaaeb5988f2ec027d8211f4e01a4f
Reviewed-on: https://gerrit.libreoffice.org/40872Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst aee0dfee
/* -*- 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_XVIEWFREEZABLE_HXX
#define INCLUDED_TEST_SHEET_XVIEWFREEZABLE_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 XViewFreezable
{
public:
virtual uno::Reference< uno::XInterface > init() = 0;
virtual ~XViewFreezable(){}
void testFreeze();
};
}
#endif // INCLUDED_TEST_SHEET_XVIEWFREEZABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -647,7 +647,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_XSubTotalDescriptor \
qadevOOo/tests/java/ifc/sheet/_XSubTotalField \
qadevOOo/tests/java/ifc/sheet/_XUniqueCellFormatRangesSupplier \
qadevOOo/tests/java/ifc/sheet/_XViewFreezable \
qadevOOo/tests/java/ifc/style/_CharacterProperties \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesAsian \
qadevOOo/tests/java/ifc/style/_CharacterPropertiesComplex \
......
......@@ -35,8 +35,6 @@
"ScTabViewObj";"com::sun::star::sheet::SpreadsheetViewSettings";"HideSpellMarks"
"ScTabViewObj";"com::sun::star::sheet::SpreadsheetViewSettings";"ZoomType"
"ScTabViewObj";"com::sun::star::sheet::SpreadsheetViewSettings";"ZoomValue"
"ScTabViewObj";"com::sun::star::sheet::XViewFreezable";"hasFrozenPanes()"
"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::XRangeSelection";"startRangeSelection()"
......
/*
* 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.XViewFreezable;
/**
* Testing <code>com.sun.star.sheet.XViewFreezable</code>
* interface methods :
* <ul>
* <li><code> hasFrozenPanes()</code></li>
* <li><code> freezeAtPosition()</code></li>
* </ul> <p>
* @see com.sun.star.sheet.XViewFreezable
*/
public class _XViewFreezable extends MultiMethodTest {
public XViewFreezable oObj = null;
/**
* Test calls the method. <p>
* Has <b> OK </b> status if the method successfully returns. <p>
*/
public void _freezeAtPosition() {
oObj.freezeAtPosition(2, 2);
tRes.tested("freezeAtPosition()", true);
}
/**
* Test calls the method, checks returned value, unfreezes panes, calls the
* method and checks returned value again. <p>
* Has <b> OK </b> status if returned value is true after first call and
* returned value is false after second. <p>
* The following method tests are to be completed successfully before :
* <ul>
* <li> <code> freezeAtPosition() </code> : to freeze panes with the
* specified number of columns and rows </li>
* </ul>
*/
public void _hasFrozenPanes() {
requiredMethod("freezeAtPosition()");
boolean result = oObj.hasFrozenPanes();
oObj.freezeAtPosition(0,0);
result &= !oObj.hasFrozenPanes();
tRes.tested("hasFrozenPanes()", result);
}
} // finish class _XViewFreezable
......@@ -8,6 +8,7 @@
*/
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/xviewfreezable.hxx>
#include <test/sheet/xviewsplitable.hxx>
#include <com/sun/star/lang/XComponent.hpp>
......@@ -21,9 +22,9 @@ using namespace css::uno;
namespace sc_apitest {
#define NUMBER_OF_TESTS 1
#define NUMBER_OF_TESTS 2
class ScTabViewObj : public CalcUnoApiTest, public apitest::XViewSplitable
class ScTabViewObj : public CalcUnoApiTest, public apitest::XViewFreezable, public apitest::XViewSplitable
{
public:
ScTabViewObj();
......@@ -33,6 +34,10 @@ public:
virtual void tearDown() override;
CPPUNIT_TEST_SUITE(ScTabViewObj);
// XViewFreezable
CPPUNIT_TEST(testFreeze);
// XViewSplitable
CPPUNIT_TEST(testSplit);
......@@ -61,9 +66,7 @@ uno::Reference< uno::XInterface > ScTabViewObj::init()
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;
return xModel->getCurrentController();
}
void ScTabViewObj::setUp()
......
......@@ -68,6 +68,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xstyleloader \
test/source/sheet/xusedareacursor \
test/source/sheet/xviewpane \
test/source/sheet/xviewfreezable \
test/source/sheet/xviewsplitable \
test/source/text/xtext \
test/source/text/xtextfield \
......
/* -*- 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/xviewfreezable.hxx>
#include <com/sun/star/sheet/XViewFreezable.hpp>
#include "cppunit/extensions/HelperMacros.h"
using namespace com::sun::star;
using namespace com::sun::star::uno;
namespace apitest {
void XViewFreezable::testFreeze()
{
uno::Reference< sheet::XViewFreezable > xViewFreezable(init(), UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE("View has already frozen panes", !xViewFreezable->hasFrozenPanes());
xViewFreezable->freezeAtPosition(1,1);
CPPUNIT_ASSERT_MESSAGE("Unable to freeze pane", xViewFreezable->hasFrozenPanes());
}
}
/* 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