Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _XDataPilotFieldGrouping.java
blob3059f675919b187a977dda294fcb837252bcfc63
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.sheet;
21 import com.sun.star.container.XNameAccess;
22 import com.sun.star.sheet.DataPilotFieldGroupBy;
23 import com.sun.star.sheet.DataPilotFieldGroupInfo;
24 import com.sun.star.sheet.XDataPilotField;
25 import com.sun.star.sheet.XDataPilotFieldGrouping;
26 import com.sun.star.uno.UnoRuntime;
27 import lib.MultiMethodTest;
29 public class _XDataPilotFieldGrouping extends MultiMethodTest
31 public XDataPilotFieldGrouping oObj = null;
33 public void _createNameGroup() {
34 boolean result = true;
35 try {
36 XDataPilotField xDataPilotField = UnoRuntime.queryInterface(XDataPilotField.class, oObj);
37 XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xDataPilotField.getItems ());
38 String[] elements = xNameAccess.getElementNames ();
39 oObj.createNameGroup(elements);
40 } catch (com.sun.star.lang.IllegalArgumentException e) {
41 log.println("Exception while checking createNameGroup"+e);
42 result = false;
44 tRes.tested ("createNameGroup()",result);
47 public void _createDateGroup() {
48 boolean result = true;
49 try {
50 DataPilotFieldGroupInfo aInfo = new DataPilotFieldGroupInfo();
51 aInfo.GroupBy = DataPilotFieldGroupBy.MONTHS;
52 aInfo.HasDateValues = true;
53 oObj.createDateGroup(aInfo);
54 } catch (com.sun.star.lang.IllegalArgumentException e) {
55 log.println("Exception while checking createDateGroup"+e);
56 result = false;
58 tRes.tested ("createDateGroup()",result);