/* * 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 mod._sc;
/** * Creating a TestEnvironment for the interfaces to be tested. * Retrieves a collection of spreadsheets from the document and takes one of * them. Fills some cell in the spreadsheet. The retrieved spreadsheet is the * instance of the service <code>com.sun.star.sheet.Spreadsheet</code>. * Object relations created : * <ul> * <li> <code>'noArray'</code> for * {@link ifc.sheet._XArrayFormulaRange}(to avoid the test of * the interface <code>XArrayFormulaRange</code>)</li> * </ul> * @see com.sun.star.sheet.XArrayFormulaRange
*/
@Override protected TestEnvironment createTestEnvironment(TestParameters Param,
PrintWriter log) throws Exception {
XInterface oObj = null;
log.println("creating a new environment for object");
TestEnvironment tEnv = new TestEnvironment(oObj);
// set the address ranges of the cells (see values set above): for e.g. XSheetOutline test
tEnv.addObjRelation("CellRangeAddress", new CellRangeAddress((short)0, 6, 6, 8, 8));
tEnv.addObjRelation("CellRangeSubAddress", new CellRangeAddress((short)0, 6, 6, 7, 8)); // pick a cell with a formula for XSheetAuditing, a dependent cell and a precedent cell
tEnv.addObjRelation("XSheetAuditing.CellAddress", new CellAddress((short)0, 8, 6));
tEnv.addObjRelation("XSheetAuditing.PrecedentCellAddress", new CellAddress((short)0, 7, 6));
tEnv.addObjRelation("XSheetAuditing.DependentCellAddress", new CellAddress((short)0, 9, 6));
// add an existing sheet for linking
tEnv.addObjRelation("XSheetLinkable.LinkSheet", "ScSheetLinksObj.ods");
//adding Scenario and with that a ScenarioSheet-Relation for Scenario and XScenarioEnhanced
XScenariosSupplier scene = UnoRuntime.queryInterface(
XScenariosSupplier.class,
tEnv.getTestObject());
scene.getScenarios()
.addNewByName("Scenario", new CellRangeAddress[] { new CellRangeAddress((short) 0, 0, 0, 10, 10)
}, "Comment");
// XSearchable interface test try {
tEnv.addObjRelation("XSearchable.MAKEENTRYINCELL", new XCell[] {
oSheet.getCellByPosition(15, 15),
oSheet.getCellByPosition(15, 16)
});
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace(log);
log.println( "Cannot make required object relation 'XSearchable.MAKEENTRYINCELL'.");
}
//Adding relation for util.XSortable final PrintWriter finalLog = log; final XCellRange oTable = oSheet;
tEnv.addObjRelation("SORTCHECKER", new ifc.util._XSortable.XSortChecker() {
PrintWriter out = finalLog;
publicvoid setPrintWriter(PrintWriter log) {
out = log;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.