diff options
Diffstat (limited to 'sc/source/ui/vba/testvba')
-rw-r--r-- | sc/source/ui/vba/testvba/launchTest.pl | 14 | ||||
-rwxr-xr-x | sc/source/ui/vba/testvba/runTests.pl | 4 | ||||
-rw-r--r-- | sc/source/ui/vba/testvba/testResult.pl | 26 | ||||
-rwxr-xr-x | sc/source/ui/vba/testvba/testResults.pl | 24 | ||||
-rw-r--r-- | sc/source/ui/vba/testvba/testvba.cxx | 76 | ||||
-rwxr-xr-x | sc/source/ui/vba/testvba/timestampsClean.pl | 2 |
6 files changed, 73 insertions, 73 deletions
diff --git a/sc/source/ui/vba/testvba/launchTest.pl b/sc/source/ui/vba/testvba/launchTest.pl index 243798616052..5b64f7522c09 100644 --- a/sc/source/ui/vba/testvba/launchTest.pl +++ b/sc/source/ui/vba/testvba/launchTest.pl @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -31,14 +31,14 @@ my $test_class = shift || die 'must provide a ext name'; my $TESTDOCUMENT = shift || die 'must provide a path to testdocument dirs'; my $OUTPUTDIR = shift || die 'must provide an output path to deposit logs in'; -die "can't access TestClass $test_class/TestVBA.class" unless -f "$test_class/TestVBA.class"; -die "can't access officepath env variable \$OFFICEPATH" unless -d $ENV{OFFICEPATH}; -die "can't access testdocuments" unless -d $TESTDOCUMENT; -die "testdocument not of the correct structure $TESTDOCUMENT/logs/excel" unless -d "$TESTDOCUMENT/logs/excel"; -die "can't access output dir" unless -d $OUTPUTDIR; +die "can't access TestClass $test_class/TestVBA.class" unless -f "$test_class/TestVBA.class"; +die "can't access officepath env variable \$OFFICEPATH" unless -d $ENV{OFFICEPATH}; +die "can't access testdocuments" unless -d $TESTDOCUMENT; +die "testdocument not of the correct structure $TESTDOCUMENT/logs/excel" unless -d "$TESTDOCUMENT/logs/excel"; +die "can't access output dir" unless -d $OUTPUTDIR; -my $officeclasspath = "$ENV{OFFICEPATH}/program/classes/"; +my $officeclasspath = "$ENV{OFFICEPATH}/program/classes/"; my $classpath = "$officeclasspath/jurt.jar:$officeclasspath/unoil.jar:$officeclasspath/juh.jar:$officeclasspath/java_uno.jar:$officeclasspath/ridl.jar:$test_class:$ENV{CLASSPATH}"; $ENV{CLASSPATH}=$classpath; print "classpath $ENV{CLASSPATH}\n"; diff --git a/sc/source/ui/vba/testvba/runTests.pl b/sc/source/ui/vba/testvba/runTests.pl index e686a1d4cb89..70f80329cfeb 100755 --- a/sc/source/ui/vba/testvba/runTests.pl +++ b/sc/source/ui/vba/testvba/runTests.pl @@ -51,7 +51,7 @@ $failed = ( $exit_value || $signal_num || $dumped_core ); print "$failed = ( $exit_value || $signal_num || $dumped_core )\n"; if ( !$failed && open(UNAME, "uname -a|") ) { - $theResult = <UNAME>; + $theResult = <UNAME>; close(UNAME); if ( $theResult =~ /^CYGWIN/ ) { # windows under cygwin @@ -62,7 +62,7 @@ if ( !$failed && open(UNAME, "uname -a|") ) { uri_escape($testDocDir); # hacky windows url construction $testDocDir="file:///$testDocDir"; - + chomp($testDocDir); #print "*** doc dir is $testDocDir\n"; $testLogDir = `cygpath -m "$testLogDir"`; diff --git a/sc/source/ui/vba/testvba/testResult.pl b/sc/source/ui/vba/testvba/testResult.pl index 5f065924d5c4..171be2597ddb 100644 --- a/sc/source/ui/vba/testvba/testResult.pl +++ b/sc/source/ui/vba/testvba/testResult.pl @@ -11,13 +11,13 @@ my $timestampclean= "perl $binDir/timestampsClean.pl"; sub testLog { # 2 No Log to compare against - # 1 Log passed + # 1 Log passed # 0 Log failed my $result = 0; my $testfile = shift; my $dirtocheck = shift; my $filename = basename($testfile); - $filename = "$logdir/$filename"; + $filename = "$logdir/$filename"; print "processing $testfile $filename\n"; if ( -f $filename ) { my $tmpFile; @@ -29,9 +29,9 @@ sub testLog my $info = stat($tmpFile) or die "no $tmpFile: $!"; if ( ($status >>=8) == 0 && ( $info->size == 0) ) { #print "diff worked size is 0\n"; - $result = 1; + $result = 1; } - elsif ( ($status >>=8) == 0 && ( $info->size > 0) ) + elsif ( ($status >>=8) == 0 && ( $info->size > 0) ) { #print "diff worked size > 0\n"; $result = 0; @@ -106,9 +106,9 @@ sub slurp_dir($) while ($fname = readdir ($dirhandle)) { $fname = filter_crud($fname); defined $fname || next; -# if (-d "$dir/$fname") { -# push @files, slurp_dir("$dir/$fname"); -# } else +# if (-d "$dir/$fname") { +# push @files, slurp_dir("$dir/$fname"); +# } else { push @files, "$dir/$fname"; } @@ -136,9 +136,9 @@ print "$testfilepath\n"; for $a (@files) { $filename = $a; if ( "$testfilepath" eq "$filename" ) - { + { $processed++; - my $testcase = $a; + my $testcase = $a; $testcase =~ s/\.log/\.xls/; my $result = testLog( $a, $logdir ); if ( $result == 0 ) { @@ -148,13 +148,13 @@ for $a (@files) { elsif ( $result == 2 ) { #print "skipped $a\n"; push @skippedTests, $testcase; - } + } else { $passed++; push @passedTests, $testcase; - #print "Test document for $a \t \t passed. \n"; - } + #print "Test document for $a \t \t passed. \n"; } + } } my $compared=@passedTests+@failedTests; my $skip = @skippedTests; @@ -163,7 +163,7 @@ print "compared $compared test-case documents\n"; print "\t \t $passed tests $@passedTests\n"; if ( @failedTests > 0 ) { print "the following test-case documents failed, please examine the logs manually\n"; - + for $a (@failedTests) { print "\t$a\n"; } diff --git a/sc/source/ui/vba/testvba/testResults.pl b/sc/source/ui/vba/testvba/testResults.pl index 39ec26ba38be..6f731327e76b 100755 --- a/sc/source/ui/vba/testvba/testResults.pl +++ b/sc/source/ui/vba/testvba/testResults.pl @@ -11,13 +11,13 @@ my $timestampclean= "perl $binDir/timestampsClean.pl"; sub testLog { # 2 No Log to compare against - # 1 Log passed + # 1 Log passed # 0 Log failed my $result = 0; my $testfile = shift; my $dirtocheck = shift; my $filename = basename($testfile); - $filename = "$logdir/$filename"; + $filename = "$logdir/$filename"; print "processing $testfile $filename\n"; if ( -f $filename ) { my $tmpFile; @@ -29,9 +29,9 @@ sub testLog my $info = stat($tmpFile) or die "no $tmpFile: $!"; if ( ($status >>=8) == 0 && ( $info->size == 0) ) { #print "diff worked size is 0\n"; - $result = 1; + $result = 1; } - elsif ( ($status >>=8) == 0 && ( $info->size > 0) ) + elsif ( ($status >>=8) == 0 && ( $info->size > 0) ) { #print "diff worked size > 0\n"; $result = 0; @@ -106,9 +106,9 @@ sub slurp_dir($) while ($fname = readdir ($dirhandle)) { $fname = filter_crud($fname); defined $fname || next; -# if (-d "$dir/$fname") { -# push @files, slurp_dir("$dir/$fname"); -# } else +# if (-d "$dir/$fname") { +# push @files, slurp_dir("$dir/$fname"); +# } else { push @files, "$dir/$fname"; } @@ -131,7 +131,7 @@ my @failedTests=(); my $failureCmd=""; for $a (@files) { $processed++; - my $testcase = $a; + my $testcase = $a; $testcase =~ s/\.log/\.xls/; my $result = testLog( $a, $logdir ); if ( $result == 0 ) { @@ -141,12 +141,12 @@ for $a (@files) { elsif ( $result == 2 ) { #print "skipped $a\n"; push @skippedTests, $testcase; - } + } else { $passed++; push @passedTests, $testcase; - #print "Test document for $a \t \t passed. \n"; - } + #print "Test document for $a \t \t passed. \n"; + } } my $compared=@passedTests+@failedTests; my $skip = @skippedTests; @@ -155,7 +155,7 @@ print "compared $compared test-case documents\n"; print "\t \t $passed tests $@passedTests\n"; if ( @failedTests > 0 ) { print "the following test-case documents failed, please examine the logs manually\n"; - + for $a (@failedTests) { print "\t$a\n"; } diff --git a/sc/source/ui/vba/testvba/testvba.cxx b/sc/source/ui/vba/testvba/testvba.cxx index cf04d45250db..f240c523edc6 100644 --- a/sc/source/ui/vba/testvba/testvba.cxx +++ b/sc/source/ui/vba/testvba/testvba.cxx @@ -45,7 +45,7 @@ using ::rtl::OUString; using ::std::auto_ptr; -const OUString EXTN = rtl::OUString::createFromAscii(".xls"); +const OUString EXTN = rtl::OUString::createFromAscii(".xls"); OUString convertToURL( const OUString& rPath ) { @@ -92,16 +92,16 @@ private: rtl::OUString msOutDirPath; protected: public: - TestVBA( const Reference< XComponentContext >& _xContext, - const Reference< XMultiComponentFactory >& _xMCF, - const Reference< XComponentLoader >& _xCompLoader, - const rtl::OUString& _outDirPath ) : mxContext( _xContext ), mxMCF( _xMCF ), -mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) + TestVBA( const Reference< XComponentContext >& _xContext, + const Reference< XMultiComponentFactory >& _xMCF, + const Reference< XComponentLoader >& _xCompLoader, + const rtl::OUString& _outDirPath ) : mxContext( _xContext ), mxMCF( _xMCF ), +mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) { mxSFA.set( mxMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), mxContext), uno::UNO_QUERY_THROW ); - } + } - rtl::OUString getLogLocation() throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception ) + rtl::OUString getLogLocation() throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception ) { rtl::OUString sLogLocation; Reference< XPropertySet > pathSettings( mxMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.comp.framework.PathSettings" ), mxContext), uno::UNO_QUERY_THROW ); @@ -109,7 +109,7 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) sLogLocation = sLogLocation.concat( rtl::OUString::createFromAscii( "/" ) ).concat( rtl::OUString::createFromAscii( "HelperAPI-test.log" ) ); return sLogLocation; } - rtl::OUString getLogLocationWithName( OUString fileName ) throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception ) + rtl::OUString getLogLocationWithName( OUString fileName ) throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception ) { printf("%s\n", getenv("HOME") ); printf("file name %s\n", rtl::OUStringToOString( fileName, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -121,17 +121,17 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) return sLogLocation; } - void init() + void init() { // blow away previous logs? } - void proccessDocument( const rtl::OUString& sUrl ) + void proccessDocument( const rtl::OUString& sUrl ) { - if ( !mxSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".xls", 4 ) ) - + if ( !mxSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".xls", 4 ) ) + { - try + try { OSL_TRACE( "processing %s", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() ); printf( "processing %s\n", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -142,17 +142,17 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) rtl::OUString sfileUrl = convertToURL( sUrl ); printf( "try to get xDoc %s\n", rtl::OUStringToOString( sfileUrl, RTL_TEXTENCODING_UTF8 ).getStr() ); - Reference< uno::XInterface > xDoc = + Reference< uno::XInterface > xDoc = mxCompLoader->loadComponentFromURL( sfileUrl, rtl::OUString::createFromAscii( "_blank" ), 0, propertyValues); printf( "got xDoc\n" ); OUString logFileURL = convertToURL( getLogLocation() ); try { - Reference< script::provider::XScriptProviderSupplier > xSupplier( xDoc, uno::UNO_QUERY_THROW ) ; - if ( mxSFA->exists( logFileURL ) ) + Reference< script::provider::XScriptProviderSupplier > xSupplier( xDoc, uno::UNO_QUERY_THROW ) ; + if ( mxSFA->exists( logFileURL ) ) mxSFA->kill( logFileURL ); - + printf("try to get the ScriptProvider\n"); Reference< script::provider::XScriptProvider > xProv = xSupplier->getScriptProvider(); printf("get the ScriptProvider\n"); @@ -176,9 +176,9 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) Sequence< uno::Any > aArgs; Sequence< sal_Int16 > aOutArgsIndex; Sequence< uno::Any > aOutArgs; - - xScript->invoke(aArgs, aOutArgsIndex, aOutArgs); - + + xScript->invoke(aArgs, aOutArgsIndex, aOutArgs); + OUString fileName = sUrl.copy ( sUrl.lastIndexOf( '/' ) ); OUString newLocation = msOutDirPath + fileName.copy ( 0, fileName.lastIndexOf( EXTN ) ) + rtl::OUString::createFromAscii( ".log" ); try @@ -196,7 +196,7 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) OSL_TRACE("new logfile location is %s ", rtl::OUStringToOString( newLocation, RTL_TEXTENCODING_UTF8 ).getStr() ); printf("moved to new location\n"); } - + } catch ( uno::Exception& e ) { @@ -205,8 +205,8 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) // interface is supported, otherwise use XComponent.dispose Reference< util::XCloseable > xCloseable ( xDoc, uno::UNO_QUERY ); - - if ( xCloseable.is() ) + + if ( xCloseable.is() ) { printf("try to close\n"); // will close application. and only run a test case for 3.0 @@ -216,8 +216,8 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) // so, for run all test cases, it should not close the document at this moment. xCloseable->close(sal_False); printf("closed\n"); - } - else + } + else { printf("try to dispose\n"); Reference< XComponent > xComp( xDoc, uno::UNO_QUERY_THROW ); @@ -226,32 +226,32 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) ) printf("disposed\n"); } } - catch( uno::Exception& e ) + catch( uno::Exception& e ) { std::cerr << "Caught exception " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << std::endl; } - + } printf("complete processing %s\n", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() ); } - void traverse( const rtl::OUString& sFileDirectory ) + void traverse( const rtl::OUString& sFileDirectory ) { - rtl::OUString sFileDirectoryURL = convertToURL( sFileDirectory ); - if ( !mxSFA->isFolder( sFileDirectoryURL) ) + rtl::OUString sFileDirectoryURL = convertToURL( sFileDirectory ); + if ( !mxSFA->isFolder( sFileDirectoryURL) ) { throw lang::IllegalArgumentException( rtl::OUString::createFromAscii( "not a directory: ").concat( sFileDirectoryURL ), Reference<uno::XInterface>(), 1 ); - } + } // Getting all files and directories in the current directory Sequence<OUString> entries = mxSFA->getFolderContents( sFileDirectoryURL, sal_False ); - + // Iterating for each file and directory printf( "Entries %d\n", (int)entries.getLength() ); - for ( sal_Int32 i = 0; i < entries.getLength(); ++i ) + for ( sal_Int32 i = 0; i < entries.getLength(); ++i ) { proccessDocument( entries[ i ] ); } - } + } }; void tryDispose( Reference< uno::XInterface > xIF, const char* sComp ) @@ -262,7 +262,7 @@ void tryDispose( Reference< uno::XInterface > xIF, const char* sComp ) try { xComponent->dispose(); - } + } catch( uno::Exception& e ) { std::cerr << "tryDispose caught exception " <<rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() << " while disposing " << sComp << std::endl; @@ -298,8 +298,8 @@ int main( int argv, char** argc ) dTest->traverse( ascii( argc[ 1 ] ) ); } delete dTest; -// tryDispose( xLoader, "desktop" ); -// tryDispose( xCC, "remote context" ); +// tryDispose( xLoader, "desktop" ); +// tryDispose( xCC, "remote context" ); } catch( uno::Exception& e ) diff --git a/sc/source/ui/vba/testvba/timestampsClean.pl b/sc/source/ui/vba/testvba/timestampsClean.pl index dade65c7200f..2c947d0cc6d5 100755 --- a/sc/source/ui/vba/testvba/timestampsClean.pl +++ b/sc/source/ui/vba/testvba/timestampsClean.pl @@ -65,7 +65,7 @@ while (<>) { output_lines(\@lines); # $detectedSomeGuff contains the skipped hunks that contain acceptable diff -# e.g. a timestamp or an OK assertion that contains different content +# e.g. a timestamp or an OK assertion that contains different content # like perhaps a path #print "frag_count = $frag_count fragstocount = $fragstocount detectedSomeGuff = $detectedSomeGuff \n"; if ($frag_count > $detectedSomeGuff) { |