calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / testtools / source / servicetests / TestBase.java
blob20532ff4d32cc8f53449e2734456a67eb8d257b1
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 servicetests;
21 import com.sun.star.uno.UnoRuntime;
22 import complexlib.ComplexTestCase;
23 import util.WaitUnreachable;
25 public abstract class TestBase extends ComplexTestCase {
26 @Override
27 public final String[] getTestMethodNames() {
28 return new String[] { "test" };
31 public final void test() throws Exception {
32 TestServiceFactory factory = getTestServiceFactory();
33 TestService2 t = UnoRuntime.queryInterface(
34 TestService2.class, factory.get());
35 assure(t != null);
36 assure(UnoRuntime.queryInterface(TestService1.class, t) == t);
37 assure(UnoRuntime.queryInterface(XTestService1.class, t) == t);
38 assure(UnoRuntime.queryInterface(XTestService2.class, t) == t);
39 assure(t.fn1() == 1);
40 assure(t.getProp1() == 1);
41 t.setProp1(0);
42 assure(t.getProp1() == 0);
43 assure(t.getProp2() == 2);
44 assure(t.getProp3Long() == 3);
45 assure(t.getProp4Long() == 4);
46 assure(t.getProp5Long() == 5);
47 assure(t.getProp6() == 6);
48 t.setProp6(0);
49 assure(t.getProp6() == 0);
50 assure(t.getProp7() == 7);
51 t.setProp7(0);
52 assure(t.getProp7() == 0);
53 assure(t.getProp8Long() == 8);
54 t.setProp8Long(0);
55 assure(t.getProp8Long() == 0);
56 assure(t.fn2() == 2);
57 XTestService3 t3 = UnoRuntime.queryInterface(XTestService3.class, t);
58 assure(t3 != null);
59 assure(t3.fn3() == 3);
60 XTestService4 t4 = UnoRuntime.queryInterface(XTestService4.class, t);
61 assure(t4 == null);
62 WaitUnreachable u = new WaitUnreachable(t);
63 t = null;
64 WaitUnreachable.ensureFinalization(t3);
65 t3 = null;
66 WaitUnreachable.ensureFinalization(t4);
67 t4 = null;
68 u.waitUnreachable();
69 factory.dispose();
72 protected abstract TestServiceFactory getTestServiceFactory()
73 throws Exception;
75 protected interface TestServiceFactory {
76 Object get() throws Exception;
78 void dispose() throws Exception;