diff options
12 files changed, 337 insertions, 14 deletions
diff --git a/qadevOOo/runner/complexlib/Assurance.java b/qadevOOo/runner/complexlib/Assurance.java index 05784b032391..e9621ca354fa 100644 --- a/qadevOOo/runner/complexlib/Assurance.java +++ b/qadevOOo/runner/complexlib/Assurance.java @@ -32,6 +32,9 @@ package complexlib; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + /** * * @author ll93751 @@ -238,6 +241,96 @@ public class Assurance assureEquals( message, expected, actual, false ); } + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _message is the message to print when the check fails + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method. + * @param _argClasses are the classes to assume for the arguments of the methods + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + protected void assureException( final String _message, final Object _object, final String _methodName, + final Class[] _argClasses, final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + Class objectClass = _object.getClass(); + + boolean noExceptionAllowed = ( _expectedExceptionClass == null ); + + boolean caughtExpected = noExceptionAllowed ? true : false; + try + { + Method method = objectClass.getMethod( _methodName, _argClasses ); + method.invoke(_object, _methodArgs ); + } + catch ( InvocationTargetException e ) + { + caughtExpected = noExceptionAllowed + ? false + : ( e.getTargetException().getClass().equals( _expectedExceptionClass ) ); + } + catch( Exception e ) + { + caughtExpected = false; + } + + assure( _message, caughtExpected ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _message is the message to print when the check fails + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method. Those implicitly define + * the classes of the arguments of the method which is called. + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + protected void assureException( final String _message, final Object _object, final String _methodName, + final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + Class[] argClasses = new Class[ _methodArgs.length ]; + for ( int i=0; i<_methodArgs.length; ++i ) + argClasses[i] = _methodArgs[i].getClass(); + assureException( _message, _object, _methodName, argClasses, _methodArgs, _expectedExceptionClass ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method. Those implicitly define + * the classes of the arguments of the method which is called. + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + protected void assureException( final Object _object, final String _methodName, final Object[] _methodArgs, + final Class _expectedExceptionClass ) + { + assureException( + "did not catch the expected exception (" + + ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + + ") while calling " + _object.getClass().getName() + "." + _methodName, + _object, _methodName, _methodArgs, _expectedExceptionClass ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method + * @param _argClasses are the classes to assume for the arguments of the methods + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + protected void assureException( final Object _object, final String _methodName, final Class[] _argClasses, + final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + assureException( + "did not catch the expected exception (" + + ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + + ") while calling " + _object.getClass().getName() + "." + _methodName, + _object, _methodName, _argClasses, _methodArgs, _expectedExceptionClass ); + } + /** * Mark the currently executed method as failed. * This function generates "Test did fail." as standard message. diff --git a/qadevOOo/runner/complexlib/ShowTargets.java b/qadevOOo/runner/complexlib/ShowTargets.java new file mode 100644 index 000000000000..c48db7092d09 --- /dev/null +++ b/qadevOOo/runner/complexlib/ShowTargets.java @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ShowTargets.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complexlib; + +/** + * + * @author fs93730 + */ +public class ShowTargets +{ + /** Creates a new instance of ShowTargets */ + public ShowTargets() + { + } + + public static void main( String[] args ) + { + java.util.Vector targets = new java.util.Vector(); + java.util.Vector descs = new java.util.Vector(); + + targets.add( "run" ); + descs.add( "runs all complex tests in this module" ); + + int maxTargetLength = 3; + + for ( int i = 0; i < args.length; ++i ) + { + String completePotentialClassName = args[i].replace( '/', '.' ); + + // filter + if ( completePotentialClassName.endsWith( ".TestCase" ) ) + continue; + if ( completePotentialClassName.endsWith( ".TestSkeleton" ) ) + continue; + + // get the class + Class potentialTestClass = null; + try { potentialTestClass = Class.forName( completePotentialClassName ); } + catch( java.lang.ClassNotFoundException e ) + { + continue; + } + + // see if it is derived from complexlib.ComplexTestCase + Class superClass = potentialTestClass.getSuperclass(); + while ( superClass != null ) + { + if ( superClass.getName().equals( "complexlib.ComplexTestCase" ) ) + { + String bareClassName = completePotentialClassName.substring( completePotentialClassName.lastIndexOf( '.' ) + 1 ); + String target = "run_" + bareClassName; + targets.add( target ); + descs.add( getShortTestDescription( potentialTestClass ) ); + + if ( maxTargetLength < target.length() ) + maxTargetLength = target.length(); + break; + } + superClass = superClass.getSuperclass(); + } + } + + System.out.println( "possible targets:" ); + for ( int i=0; i<targets.size(); ++i ) + { + // target + String target = (String)targets.get(i); + // 'tab' + System.out.print( " " + target ); + for ( int s = maxTargetLength - target.length(); s>0; --s ) + System.out.print( " " ); + // description + System.out.println( " (" + (String)descs.get(i) + ")" ); + } + } + + /** determines if the test denoted by a given Class is an interactive test + */ + static private boolean isInteractiveTest( Class testClass ) + { + java.lang.reflect.Method interactiveTestMethod = null; + try { interactiveTestMethod = testClass.getMethod( "isInteractiveTest", new Class[]{} ); } + catch( Exception e ) { } + + if ( interactiveTestMethod != null ) + { + try + { + Boolean result = (Boolean)interactiveTestMethod.invoke( null, new Object[]{} ); + return result.booleanValue(); + } + catch( Exception e ) { } + } + return false; + } + + static private String getShortTestDescription( Class _testClass ) + { + java.lang.reflect.Method getShortDescriptionMethod = null; + try { getShortDescriptionMethod = _testClass.getMethod( "getShortTestDescription", new Class[]{} ); } + catch( Exception e ) { } + + if ( getShortDescriptionMethod != null ) + { + try + { + return (String)getShortDescriptionMethod.invoke( null, new Object[]{} ); + } + catch( Exception e ) { } + } + return "no description provided by the test"; + } +} diff --git a/qadevOOo/runner/complexlib/makefile.mk b/qadevOOo/runner/complexlib/makefile.mk index 950b70f293be..1e8c70d58889 100644 --- a/qadevOOo/runner/complexlib/makefile.mk +++ b/qadevOOo/runner/complexlib/makefile.mk @@ -44,7 +44,7 @@ TARGET = runner_complexlib JARFILES = ridl.jar jurt.jar unoil.jar -JAVAFILES = ComplexTestCase.java MethodThread.java +JAVAFILES = ComplexTestCase.java MethodThread.java ShowTargets.java JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) diff --git a/qadevOOo/runner/lib/TestParameters.java b/qadevOOo/runner/lib/TestParameters.java index c87a5b21f263..6a98dee32926 100644 --- a/qadevOOo/runner/lib/TestParameters.java +++ b/qadevOOo/runner/lib/TestParameters.java @@ -32,6 +32,8 @@ package lib; import java.util.Hashtable; import util.PropertyName; +import com.sun.star.beans.XPropertySet; +import com.sun.star.uno.XComponentContext; //import com.sun.star.lang.XMultiServiceFactory; @@ -292,6 +294,24 @@ public class TestParameters extends Hashtable { return ret; } + public XComponentContext getComponentContext() { + Object context = get( "ComponentContext" ); + if ( context == null ) + { + XPropertySet factoryProps = (XPropertySet)com.sun.star.uno.UnoRuntime.queryInterface( + XPropertySet.class, getMSF() ); + try + { + context = com.sun.star.uno.UnoRuntime.queryInterface( + XComponentContext.class, factoryProps.getPropertyValue( "DefaultContext" ) ); + put( "ComponentContext", context ); + } + catch( com.sun.star.beans.UnknownPropertyException e ) { } + catch( com.sun.star.lang.WrappedTargetException e ) { } + } + return (XComponentContext)context; + } + /** * Convert the system dependent operating system name to a name according * to OOo rules. diff --git a/qadevOOo/tests/java/ifc/text/_XSimpleText.java b/qadevOOo/tests/java/ifc/text/_XSimpleText.java index 785d53fec97a..84f271dae7b5 100644 --- a/qadevOOo/tests/java/ifc/text/_XSimpleText.java +++ b/qadevOOo/tests/java/ifc/text/_XSimpleText.java @@ -77,7 +77,7 @@ public class _XSimpleText extends MultiMethodTest { */ public void _insertString() { requiredMethod("createTextCursor()"); - log.println( "Testing insertString)" ); + log.println( "Testing insertString" ); String sStr = getInterfaceName() ; oObj.insertString( oCursor, sStr, false ); String gStr = oObj.getText().getString() ; diff --git a/testautomation/dbaccess/optional/includes/ctrl_TextControl.inc b/testautomation/dbaccess/optional/includes/ctrl_TextControl.inc index 2c9a352c2284..b77c8b58efcc 100755 --- a/testautomation/dbaccess/optional/includes/ctrl_TextControl.inc +++ b/testautomation/dbaccess/optional/includes/ctrl_TextControl.inc @@ -161,6 +161,9 @@ testcase tRichTextControl hFileOpen ( gOfficePath + ConvertPath("user/work/TT_RichTextBox.odt")) Kontext "DocumentWriter" DocumentWriter.TypeKeys "<MOD1 F5>" , true + qaerrorlog "workaround for issue 102010" + DocumentWriter.TypeKeys "<RIGHT>" , true + DocumentWriter.TypeKeys "<LEFT>" , true sleep(1) DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true sleep(1) @@ -168,7 +171,7 @@ testcase tRichTextControl sleep(1) 'printlog "getClipboard = " + getClipboard if ( getClipboard <> "this is a blind text" ) then - warnlog "The text in the control is not saved" + warnlog "The text in the control is not saved (" + getClipboard() + ")" end if DocumentWriter.TypeKeys "<END>" , true sleep(1) @@ -255,7 +258,10 @@ testcase tRichTextControlDraw Kontext "DocumentDraw" DocumentDraw.TypeKeys "<MOD1 F5>" , true sleep(1) - DocumentDraw.TypeKeys "<MOD1 F5>" , true + DocumentDraw.TypeKeys "<MOD1 F5>" , true + qaerrorlog "workaround for issue 102010" + DocumentDraw.TypeKeys "<RIGHT>" , true + DocumentDraw.TypeKeys "<LEFT>" , true sleep(1) DocumentDraw.TypeKeys "<MOD1 SHIFT END>" , true sleep(1) diff --git a/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc b/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc index 73527313b9f1..0d72d6c50114 100755 --- a/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc +++ b/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc @@ -393,6 +393,9 @@ endcase testcase tGroupBoxWithoutDatasource + warnlog "#102082# CTRL + C ddoes not work anymore in control properties dialog" + goto endsub + '/// open a textdocument printlog "open a textdocument" diff --git a/testautomation/dbaccess/optional/includes/db_Relations.inc b/testautomation/dbaccess/optional/includes/db_Relations.inc index 54ac5139ed47..54eb8c807caf 100755 --- a/testautomation/dbaccess/optional/includes/db_Relations.inc +++ b/testautomation/dbaccess/optional/includes/db_Relations.inc @@ -127,13 +127,13 @@ function tRelation( sFileName, sPWD, sRelTable1, sRelTable2 ) RelationProperties.TypeKeys "<MOD2 DOWN>",TRUE sleep(1) RelationProperties.TypeKeys "<DOWN>",TRUE - RelationProperties.TypeKeys "<RETURN>",TRUE + ' RelationProperties.TypeKeys "<RETURN>",TRUE sleep(1) RelationProperties.TypeKeys "<TAB>",TRUE RelationProperties.TypeKeys "<MOD2 DOWN>",TRUE sleep(1) RelationProperties.TypeKeys "<DOWN>",TRUE - RelationProperties.TypeKeys "<RETURN>",TRUE + ' RelationProperties.TypeKeys "<RETURN>",TRUE sleep(1) RelationProperties.OK printlog "1:1 relation between test tables created" @@ -151,14 +151,17 @@ function tRelation( sFileName, sPWD, sRelTable1, sRelTable2 ) sleep(1) RelationDesign.TypeKeys "<SHIFT F10>",TRUE sleep(1) - l = hMenuItemGetCount + try + l = hMenuItemGetCount + catch + endcatch MenuSelect 0 sleep(1) k = k + 1 'printlog "k = " + k 'printlog "hMenuItemGetCount = " + l - Loop Until k = 5 or l = 2 - if k = 5 then + Loop Until k = 10 or l = 2 + if k = 10 then warnlog "abort deleting relation: searching for relation connector went wrong" endif printlog "relation connector deleted" diff --git a/testautomation/dbaccess/optional/includes/db_Text.inc b/testautomation/dbaccess/optional/includes/db_Text.inc index 688b5b6e8c16..b345b872df85 100755 --- a/testautomation/dbaccess/optional/includes/db_Text.inc +++ b/testautomation/dbaccess/optional/includes/db_Text.inc @@ -130,8 +130,8 @@ testcase tOpenUTF8File(sFilename as string) call fOpendatabase(sFileName) '/// open the table text_database - printlog "open the table text_database" - call fOpenTable("text_database") + printlog "open the table text_Database" + call fOpenTable("text_Database") '/// check if the first row contains the string öäü printlog "check if the first row contains the string öäü" diff --git a/testautomation/dbaccess/optional/includes/frm_FormFilter.inc b/testautomation/dbaccess/optional/includes/frm_FormFilter.inc index e455ae6e0bb8..243e186c209d 100755 --- a/testautomation/dbaccess/optional/includes/frm_FormFilter.inc +++ b/testautomation/dbaccess/optional/includes/frm_FormFilter.inc @@ -72,6 +72,11 @@ testcase tLoadForm printlog "execute the form filter" FM_FF_Execute wait(1000) + qaerrorlog "workarounf issue 102010" + DocumentWriter.TypeKeys "<MOD1 F6>" , true + sleep(1) + DocumentWriter.TypeKeys "<MOD1 F5>" , true + sleep(1) '/// use tab to get in the second textbox printlog "use tab to get in the second textbox" DocumentWriter.TypeKeys "<TAB>" , true @@ -99,6 +104,17 @@ testcase tLoadForm printlog "execute the filter" FM_FF_Execute wait(1000) + + qaerrorlog "workarounf issue 102010" + DocumentWriter.TypeKeys "<MOD1 F6>" , true + sleep(1) + DocumentWriter.TypeKeys "<MOD1 F5>" , true + sleep(1) + + '/// use tab to get in the second textbox + printlog "use tab to get in the second textbox" + DocumentWriter.TypeKeys "<TAB>" , true + sleep(1) '/// select the text in the second textbox printlog "select the text in the second textbox" DocumentWriter.TypeKeys "<SHIFT END>" , true diff --git a/testautomation/dbaccess/optional/includes/rpt_ExecuteReport.inc b/testautomation/dbaccess/optional/includes/rpt_ExecuteReport.inc index 41bc2fad54a0..2f1c62f1f84f 100755 --- a/testautomation/dbaccess/optional/includes/rpt_ExecuteReport.inc +++ b/testautomation/dbaccess/optional/includes/rpt_ExecuteReport.inc @@ -112,6 +112,8 @@ testcase tExecute sleep(1) BackGroundColor.select 11 sleep(2) + Height.setText("5") + Height.typeKeys("<RETURN>",true) ' select detail section with unselect the control Kontext "ReportDesign" @@ -119,7 +121,7 @@ testcase tExecute ReportDesign.MouseUp(50, 10) sleep(1) Kontext "ReportGeneralProperties" - Height.setText("0") + Height.setText("5") Height.typeKeys("<RETURN>",true) sleep(1) @@ -162,8 +164,19 @@ testcase tExecute SAXSeekElement("table:table") iNumberOfChilds = SAXGetChildCount - if (iNumberOfChilds <> 64 ) then - warnlog "there should be 64 rows in the table, but there are " + iNumberOfChilds + dim iLoop as integer + dim iCount as integer + iCount = 0 + for iLoop = 1 to iNumberOfChilds + SAXSeekElement(iLoop) + if ( SAXGetElementName() = "table:table-row" ) then + iCount = iCount + 1 + endif + SAXSeekElement(0) + next + + if (iCount <> 59 ) then + warnlog "there should be 59 rows in the table, but there are " + iNumberOfChilds SAXRelease goto endsub endif diff --git a/testautomation/dbaccess/optional/includes/wiz_TableWizard.inc b/testautomation/dbaccess/optional/includes/wiz_TableWizard.inc index 481d0bbb4e92..5131b8256149 100755 --- a/testautomation/dbaccess/optional/includes/wiz_TableWizard.inc +++ b/testautomation/dbaccess/optional/includes/wiz_TableWizard.inc @@ -395,6 +395,23 @@ testcase tCreateAllTables call fOpendatabase(ConvertPath(gOfficePath + "user/work/TT_hsqldb.odb")) sleep(5) + '/// check if tehre are 22 items in the business categoriy + if not fStartTableWizard() then + warnlog "The table wizard doesn't start. TEST STOPPED" + goto endsub + endif + + Kontext "TableWizard" + dim iCount as integer + iCount = Tables.GetItemCount + if(iCount <> 22 ) then + warnlog "#102019# there are not 22 table in the category business. There are " + iCount + CancelBtn.Click + call fCloseDatabase() + goto endsub + endif + CancelBtn.Click + for i = 1 to 22 '/// start the table wizard @@ -432,6 +449,17 @@ testcase tCreateAllTables '/// now create all tables from the personal tables printlog "now create all tables from the personal tables" + Kontext "TableWizard" + Personal.Check + iCount = Tables.GetItemCount + if(iCount <> 15 ) then + warnlog "#102019# there are not 15 table in the category business. There are " + iCount + CancelBtn.Click + call fCloseDatabase() + goto endsub + endif + CancelBtn.Click + for i = 1 to 15 '/// start the table wizard printlog "start the table wizard" |