From 08894f7c7def58431be699c3e59ef7bbc0c725a4 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 7 Nov 2012 13:30:10 +0000 Subject: add native XTextSearch / cppunit test framework. ported from the broken java ver. adds a native ICU regex sanity test. --- qadevOOo/Jar_OOoRunner.mk | 2 - qadevOOo/tests/java/ifc/util/_XTextSearch.java | 110 ------------------------- qadevOOo/tests/java/mod/_i18n/TextSearch.java | 72 ---------------- 3 files changed, 184 deletions(-) delete mode 100644 qadevOOo/tests/java/ifc/util/_XTextSearch.java delete mode 100644 qadevOOo/tests/java/mod/_i18n/TextSearch.java (limited to 'qadevOOo') diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk index 4920dbcc2fc4..d6c5c9eceb9e 100644 --- a/qadevOOo/Jar_OOoRunner.mk +++ b/qadevOOo/Jar_OOoRunner.mk @@ -955,7 +955,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/ifc/util/_XSortable \ qadevOOo/tests/java/ifc/util/_XStringEscape \ qadevOOo/tests/java/ifc/util/_XStringSubstitution \ - qadevOOo/tests/java/ifc/util/_XTextSearch \ qadevOOo/tests/java/ifc/util/_XURLTransformer \ qadevOOo/tests/java/ifc/view/_XControlAccess \ qadevOOo/tests/java/ifc/view/_XFormLayerAccess \ @@ -1103,7 +1102,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\ qadevOOo/tests/java/mod/_i18n/IndexEntrySupplier \ qadevOOo/tests/java/mod/_i18n/LocaleData \ qadevOOo/tests/java/mod/_i18n/NumberFormatCodeMapper \ - qadevOOo/tests/java/mod/_i18n/TextSearch \ qadevOOo/tests/java/mod/_i18n/Transliteration \ qadevOOo/tests/java/mod/_implreg/uno/ImplementationRegistration \ qadevOOo/tests/java/mod/_impreg/ImplementationRegistration \ diff --git a/qadevOOo/tests/java/ifc/util/_XTextSearch.java b/qadevOOo/tests/java/ifc/util/_XTextSearch.java deleted file mode 100644 index abb47de60155..000000000000 --- a/qadevOOo/tests/java/ifc/util/_XTextSearch.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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.util; - -import lib.MultiMethodTest; - -import com.sun.star.util.SearchAlgorithms; -import com.sun.star.util.SearchFlags; -import com.sun.star.util.SearchOptions; -import com.sun.star.util.SearchResult; -import com.sun.star.util.XTextSearch; - -/** -* Testing com.sun.star.util.XTextSearch -* interface methods : -*

-* Test is NOT multithread compilant.

-* @see com.sun.star.util.XTextSearch -*/ -public class _XTextSearch extends MultiMethodTest { - - // oObj filled by MultiMethodTest - public XTextSearch oObj = null ; - - protected final String str = "acababaabcababadcdaa" ; - protected final int startPos = 2 , endPos = 20 ; - protected final String searchStr = "(ab)*a(c|d)+" ; - protected final int fStartRes = 10, fEndRes = 18 ; - protected final int bStartRes = 18, bEndRes = 14 ; - - /** - * Sets options for searching regular expression in a string, - * ignoring case.

- * Has OK status if no runtime exceptions occurred. - */ - public void _setOptions() { - - SearchOptions opt = new SearchOptions() ; - opt.algorithmType = SearchAlgorithms.REGEXP ; - opt.searchFlag = SearchFlags.ALL_IGNORE_CASE ; - opt.searchString = searchStr ; - - oObj.setOptions(opt) ; - - tRes.tested("setOptions()", true) ; - } - - - /** - * Tries to find a substring matching regular expression.

- * Has OK if the correct substring position returned. - */ - public void _searchForward() { - requiredMethod("setOptions()") ; - - SearchResult res = oObj.searchForward(str, startPos, endPos) ; - - log.println("Result of searching '" + searchStr + "' substring in \n'" + - str + "' string (" + res.subRegExpressions + " matches):") ; - - for (int i = 0; i < res.subRegExpressions; i++) - log.println(" (" + res.startOffset[i] + ", " + res.endOffset[i] + ")") ; - - tRes.tested("searchForward()", res.subRegExpressions > 0 && - res.startOffset[0] == fStartRes && res.endOffset[0] == fEndRes) ; - } - - /** - * Tries to find a substring matching regular expression walking - * backward.

- * Has OK if the correct substring position returned. - */ - public void _searchBackward() { - requiredMethod("setOptions()") ; - - SearchResult res = oObj.searchBackward(str, endPos, startPos) ; - - log.println("Result of searching '" + searchStr + "' substring in \n'" + - str + "' string (" + res.subRegExpressions + " matches):") ; - - for (int i = 0; i < res.subRegExpressions; i++) - log.println(" (" + res.startOffset[i] + ", " + res.endOffset[i] + ")") ; - - tRes.tested("searchBackward()", res.subRegExpressions > 0 && - res.startOffset[0] == bStartRes && res.endOffset[0] == bEndRes) ; - } - -} - - diff --git a/qadevOOo/tests/java/mod/_i18n/TextSearch.java b/qadevOOo/tests/java/mod/_i18n/TextSearch.java deleted file mode 100644 index 485f8db8099f..000000000000 --- a/qadevOOo/tests/java/mod/_i18n/TextSearch.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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._i18n; - -import java.io.PrintWriter; - -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; - -/** -* Test for object which is represented by service -* com.sun.star.util.TextSearch.

-* Object implements the following interfaces : -*

-* This object test is NOT designed to be run in several -* threads concurently. -* @see ifc.util._XTextSearch -*/ -public class TextSearch extends TestCase { - - /** - * Creating a Testenvironment for the interfaces to be tested. - * Creates an instance of the service - * com.sun.star.util.TextSearch. - */ - public TestEnvironment createTestEnvironment( TestParameters Param, - PrintWriter log ) - throws StatusException { - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF(); - oInterface = xMSF.createInstance( "com.sun.star.util.TextSearch" ); - } - catch( com.sun.star.uno.Exception e ) { - log.println("Can't create an object." ); - throw new StatusException( "Can't create an object", e ); - } - - oObj = (XInterface) oInterface; - - TestEnvironment tEnv = new TestEnvironment( oObj ); - - return tEnv; - } // finish method getTestEnvironment - -} - -- cgit