1*31e76637SAndrew Rist /************************************************************** 2*31e76637SAndrew Rist * 3*31e76637SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*31e76637SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*31e76637SAndrew Rist * distributed with this work for additional information 6*31e76637SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*31e76637SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*31e76637SAndrew Rist * "License"); you may not use this file except in compliance 9*31e76637SAndrew Rist * with the License. You may obtain a copy of the License at 10*31e76637SAndrew Rist * 11*31e76637SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*31e76637SAndrew Rist * 13*31e76637SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*31e76637SAndrew Rist * software distributed under the License is distributed on an 15*31e76637SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*31e76637SAndrew Rist * KIND, either express or implied. See the License for the 17*31e76637SAndrew Rist * specific language governing permissions and limitations 18*31e76637SAndrew Rist * under the License. 19*31e76637SAndrew Rist * 20*31e76637SAndrew Rist *************************************************************/ 21*31e76637SAndrew Rist 22*31e76637SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package org.openoffice.testgraphical.qa.graphical; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import org.openoffice.Runner; 27cdf0e10cSrcweir import org.openoffice.test.OfficeConnection; 28cdf0e10cSrcweir import static org.junit.Assert.*; 29cdf0e10cSrcweir 30cdf0e10cSrcweir import helper.ProcessHandler; 31cdf0e10cSrcweir import graphical.FileHelper; 32cdf0e10cSrcweir import java.io.File; 33cdf0e10cSrcweir 34cdf0e10cSrcweir public final class Test { 35cdf0e10cSrcweir @org.junit.Before setUp()36cdf0e10cSrcweir public void setUp() throws Exception 37cdf0e10cSrcweir { 38cdf0e10cSrcweir connection.setUp(); 39cdf0e10cSrcweir } 40cdf0e10cSrcweir 41cdf0e10cSrcweir @org.junit.After tearDown()42cdf0e10cSrcweir public void tearDown() throws Exception 43cdf0e10cSrcweir { 44cdf0e10cSrcweir connection.tearDown(); 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir @org.junit.Test test()48cdf0e10cSrcweir public void test() 49cdf0e10cSrcweir { 50cdf0e10cSrcweir boolean good = true; 51cdf0e10cSrcweir 52cdf0e10cSrcweir final String sPerlEXE = System.getenv("PERL"); 53cdf0e10cSrcweir // System.out.println("PERL:=" + sPerlEXE); 54cdf0e10cSrcweir 55cdf0e10cSrcweir final String sPRJ = System.getenv("PRJ"); 56cdf0e10cSrcweir // System.out.println("PRJ:=" + sPRJ); 57cdf0e10cSrcweir 58cdf0e10cSrcweir String sShow = ""; 59cdf0e10cSrcweir if (System.getProperty("SHOW") != null) 60cdf0e10cSrcweir { 61cdf0e10cSrcweir sShow = "-show"; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir final String sComparePath = FileHelper.appendPath(sPRJ, "source"); 65cdf0e10cSrcweir final String sCompareName = FileHelper.appendPath(sComparePath, "compare.pl"); 66cdf0e10cSrcweir 67cdf0e10cSrcweir File aCompareFile = new File(sCompareName); 68cdf0e10cSrcweir if (!aCompareFile.exists()) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir System.out.println("Path to compare.pl is wrong: '" + aCompareFile.getAbsolutePath() + "'"); 71cdf0e10cSrcweir assertTrue(false); 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir final String sConnectionString = connection.getDescription(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir String[] sCommandArray = 77cdf0e10cSrcweir { 78cdf0e10cSrcweir sPerlEXE, 79cdf0e10cSrcweir aCompareFile.getAbsolutePath(), 80cdf0e10cSrcweir "-creatortype", "pdf", 81cdf0e10cSrcweir 82cdf0e10cSrcweir // If you make changes here, do it also in ../../source/makefile.mk in selftest: target! 83cdf0e10cSrcweir 84cdf0e10cSrcweir "-pool", "singletest", 85cdf0e10cSrcweir "-document", "eis-test.odt", 86cdf0e10cSrcweir // "-pool", "demo", 87cdf0e10cSrcweir // "-document", "CurrentTime.ods", 88cdf0e10cSrcweir "-connectionstring", sConnectionString, 89cdf0e10cSrcweir // "-verbose", 90cdf0e10cSrcweir sShow 91cdf0e10cSrcweir }; 92cdf0e10cSrcweir 93cdf0e10cSrcweir ProcessHandler aHandler = new ProcessHandler(sCommandArray); 94cdf0e10cSrcweir boolean bBackValue = aHandler.executeSynchronously(); 95cdf0e10cSrcweir int nExitCode = aHandler.getExitCode(); 96cdf0e10cSrcweir 97cdf0e10cSrcweir // String sBack = aHandler.getOutputText(); 98cdf0e10cSrcweir if (nExitCode != 0) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir good = false; 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir assertTrue(good); 104cdf0e10cSrcweir 105cdf0e10cSrcweir // Runner.run( 106cdf0e10cSrcweir // "-sce", "sw.sce", "-xcl", "knownissues.xcl", "-tdoc", 107cdf0e10cSrcweir // "testdocuments", "-cs", connection.getDescription())); 108cdf0e10cSrcweir } 109cdf0e10cSrcweir 110cdf0e10cSrcweir private final OfficeConnection connection = new OfficeConnection(); 111cdf0e10cSrcweir } 112