tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _XShapeDescriptor.java
blobef088b91c37c90d2ea8ddd8a3d6a12f5eefe8ecb
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.drawing;
21 import lib.MultiMethodTest;
23 import com.sun.star.drawing.XShapeDescriptor;
24 import com.sun.star.lang.XServiceInfo;
25 import com.sun.star.uno.UnoRuntime;
27 /**
28 * Testing <code>com.sun.star.drawing.XShapeDescriptor</code>
29 * interface methods :
30 * <ul>
31 * <li><code> getShapeType()</code></li>
32 * </ul> <p>
33 * Test is <b> NOT </b> multithread compliant. <p>
34 * @see com.sun.star.drawing.XShapeDescriptor
36 public class _XShapeDescriptor extends MultiMethodTest {
38 public XShapeDescriptor oObj = null;
39 boolean result = true;
41 /**
42 * Gets the type of shape. This type must be a service name which
43 * is supported by object (except of ChartObject and Frame shapes).
44 * The object is queried for <code>XServiceInfo</code> and
45 * the type is checked to be among supported service names.<p>
47 * Has <b> OK </b> status if the type is found among supported
48 * services. Or if the object represents a text frame.<p>
50 public void _getShapeType() {
51 result = false;
53 String stype = oObj.getShapeType();
54 log.println("Current Shape Type is " + stype);
56 XServiceInfo SI = UnoRuntime.queryInterface(XServiceInfo.class, oObj);
58 String[] serviceNames = SI.getSupportedServiceNames();
60 log.println("Supported services :");
61 for (int i = 0; i < serviceNames.length; i++) {
62 log.println(" " + serviceNames[i]);
63 if (serviceNames[i].equals(stype))
64 result = true;
67 //remark: we should provide the expected name as ObjRelation
69 //Chart has its own behaviour it always return 'ChartObject'
70 if (stype.equals("com.sun.star.chart.ChartObject")) result=true;
71 if (stype.equals("com.sun.star.drawing.ControlShape")) result=true;
72 if (stype.equals("com.sun.star.drawing.ClosedBezierShape")) result=true;
73 if (stype.equals("com.sun.star.drawing.CaptionShape")) result=true;
75 //Writer has its own behaviour it returns a 'FrameShape'
76 if (stype.equals("FrameShape")) result=true;
78 if (!result) {
79 log.println("Service " + stype + " not supported in the object.");
82 tRes.tested("getShapeType()", result);