/*
* 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.inspection;
import com.sun.star.inspection.XObjectInspector;
import com.sun.star.inspection.XObjectInspectorModel;
import com.sun.star.inspection.XObjectInspectorUI;
import lib.MultiMethodTest;
import lib.Status;
import lib.StatusException;
/**
* Testing com.sun.star.inspection.XObjectInspector
* interface methods :
*
inspect()
InspectorModel()
* Test is NOT multithread compliant.
* * This test needs the following object relations : *
'XObjectInspector.toInspect'
* (of type Object []
):
* acceptable collection of one or more objects which can be inspected by inspect()
*
*/
public class _XObjectInspector extends MultiMethodTest {
/**
* the test object
*/
public XObjectInspector oObj = null;
/**
* This variable was filled with the object relation
* XObjectInspector.toInspect
and was used to
* test the method inspect()
*/
public Object[] oInspect = null;
/**
* This variable was filled with the object relation
* XObjectInspector.InspectorModelToSet
and was used to
* test the method setInspectorModel()
*/
public XObjectInspectorModel xSetModel = null;
/**
* get object relations
*
XObjectInspector.toInspect
getInspectorModel()
and save the valuesetInspectorModel()
with the module variable
* xSetModel
as parameter.getInspectorModel()
* was called and the returned valued was compared to the saved variable
* xSetModel
OK
status if the returned value is equal to
* xSetModel
.and the saved value is not null.
*/
public void _InspectorModel() {
log.println("testing 'getInspectorModel()'...");
XObjectInspectorModel xGetModel = oObj.getInspectorModel() ;
boolean result = xGetModel != null;
log.println(result? "got a not null object -> OK" : "got a NULL object -> FAILED");
log.println("testing 'setInspectorModel()'...");
oObj.setInspectorModel(xSetModel);
XObjectInspectorModel xNewModel = oObj.getInspectorModel();
if (result) oObj.setInspectorModel(xGetModel);
result &= xSetModel.equals(xNewModel);
tRes.tested("InspectorModel()", result) ;
}
/**
* Calls the method getInspectorUI()
* Has OK returned value is not null
*/
public void _InspectorUI() {
XObjectInspectorUI oUI = oObj.getInspectorUI();
tRes.tested("InspectorUI()", oUI != null) ;
}
}