1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package graphical; 25 26 // import java.io.File; 27 28 /** 29 * 30 * @author ll93751 31 */ 32 public class JPEGEvaluator extends EnhancedComplexTestCase 33 { 34 // @Override getTestMethodNames()35 public String[] getTestMethodNames() 36 { 37 return new String[]{"EvaluateResult"}; 38 } 39 40 /** 41 * test function. 42 */ EvaluateResult()43 public void EvaluateResult() 44 { 45 GlobalLogWriter.set(log); 46 ParameterHelper aParam = new ParameterHelper(param); 47 48 // aParam.getTestParameters().put("current_ok_status", -1); 49 50 // run through all documents found in Inputpath 51 foreachResultCreateHTML(aParam); 52 } 53 checkOneFile(String _sDocument, String _sResult, ParameterHelper _aParams)54 public void checkOneFile(String _sDocument, String _sResult, ParameterHelper _aParams) throws OfficeException 55 { 56 // throw new UnsupportedOperationException("Not supported yet."); 57 // int dummy = 0; 58 59 String sBasename = FileHelper.getBasename(_sDocument); 60 String sResultIniFile = _sDocument + ".ini"; 61 // File aFile = new File(sResultIniFile); 62 // assure("Result file doesn't exists " + sResultIniFile, aFile.exists()); 63 // 64 // int good = 0; 65 // int bad = 0; 66 // int ugly = 0; 67 // 68 // IniFile aResultIniFile = new IniFile(sResultIniFile); 69 // int nPages = aResultIniFile.getIntValue("global", "pages", 0); 70 // for (int i=0;i<nPages;i++) 71 // { 72 // String sCurrentPage = "page" + String.valueOf(i + 1); 73 // int nPercent = aResultIniFile.getIntValue(sCurrentPage, "percent", -1); 74 // if (nPercent == 0) 75 // { 76 // good++; 77 // } 78 // else if (nPercent <= 5) 79 // { 80 // bad ++; 81 // } 82 // else 83 // { 84 // ugly ++; 85 // } 86 // } 87 // 88 // assure("Error: document doesn't contains pages", nPages > 0); 89 90 HTMLResult aOutputter = new HTMLResult(_sResult, sBasename + ".html" ); 91 aOutputter.header(_sResult); 92 aOutputter.indexSection(sBasename); 93 94 IniFile aResultIniFile = new IniFile(sResultIniFile); 95 String sStatusRunThrough = aResultIniFile.getValue("global", "state"); 96 String sStatusMessage = aResultIniFile.getValue("global", "info"); 97 98 // // TODO: this information has to come out of the ini files 99 // String sStatusRunThrough = "PASSED, "; 100 // String sPassed = "OK"; 101 // 102 // String sStatusMessage = "From " + nPages + " page(s) are: "; 103 // String sGood = ""; 104 // String sBad = ""; 105 // String sUgly = ""; 106 // 107 // if (good > 0) 108 // { 109 // sGood = " good:=" + good; 110 // sStatusMessage += sGood; 111 // } 112 // if (bad > 0) 113 // { 114 // sBad = " bad:=" + bad; 115 // sStatusMessage += sBad; 116 // } 117 // if (ugly > 0) 118 // { 119 // sUgly = " ugly:=" + ugly; 120 // sStatusMessage += sUgly; 121 // } 122 // 123 // // Failure matrix 124 // // 0 1 125 // // ugly OK FAILED 126 // // bad OK 127 // // good OK 128 // 129 // if (ugly > 0) 130 // { 131 // sPassed = "FAILED"; 132 // } 133 // else 134 // { 135 // if (bad > 0) 136 // { 137 // sPassed = "NEED A LOOK"; 138 // } 139 // else 140 // { 141 // sPassed = "OK"; 142 // } 143 // } 144 // sStatusRunThrough += sPassed; 145 // aResultIniFile.insertValue("global", "state", sStatusRunThrough); 146 // aResultIniFile.insertValue("global", "info", sStatusMessage); 147 // aResultIniFile.close(); 148 149 String sHTMLFile = _aParams.getHTMLPrefix(); // "http://so-gfxcmp-lin/gfxcmp_ui/cw.php?inifile="; 150 sHTMLFile += _sDocument + ".ini"; 151 aOutputter.indexLine(sHTMLFile, sBasename, sStatusRunThrough, sStatusMessage); 152 aOutputter.close(); 153 // IniFile aIniFile = new IniFile(_sDocument); 154 // aIniFile. 155 156 } 157 158 159 } 160