update dev300-m58
[ooovba.git] / qadevOOo / runner / graphical / JPEGEvaluator.java
blob96998e4c6227f870910baea5205a107613889695
1 /*
2 * ************************************************************************
3 *
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * Copyright 2008 by Sun Microsystems, Inc.
7 *
8 * OpenOffice.org - a multi-platform office productivity suite
9 *
10 * $RCSfile: JPEGEvaluator.java,v $
11 * $Revision: 1.1.2.4 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 * ***********************************************************************
33 package graphical;
35 // import java.io.File;
37 /**
39 * @author ll93751
41 public class JPEGEvaluator extends EnhancedComplexTestCase
43 // @Override
44 public String[] getTestMethodNames()
46 return new String[]{"EvaluateResult"};
49 /**
50 * test function.
52 public void EvaluateResult()
54 GlobalLogWriter.set(log);
55 ParameterHelper aParam = new ParameterHelper(param);
57 // run through all documents found in Inputpath
58 foreachResultCreateHTML(aParam);
61 public void checkOneFile(String _sDocument, String _sResult, ParameterHelper _aParams) throws OfficeException
63 // throw new UnsupportedOperationException("Not supported yet.");
64 // int dummy = 0;
66 String sBasename = FileHelper.getBasename(_sDocument);
67 String sResultIniFile = _sDocument + ".ini";
68 // File aFile = new File(sResultIniFile);
69 // assure("Result file doesn't exists " + sResultIniFile, aFile.exists());
70 //
71 // int good = 0;
72 // int bad = 0;
73 // int ugly = 0;
74 //
75 // IniFile aResultIniFile = new IniFile(sResultIniFile);
76 // int nPages = aResultIniFile.getIntValue("global", "pages", 0);
77 // for (int i=0;i<nPages;i++)
78 // {
79 // String sCurrentPage = "page" + String.valueOf(i + 1);
80 // int nPercent = aResultIniFile.getIntValue(sCurrentPage, "percent", -1);
81 // if (nPercent == 0)
82 // {
83 // good++;
84 // }
85 // else if (nPercent <= 5)
86 // {
87 // bad ++;
88 // }
89 // else
90 // {
91 // ugly ++;
92 // }
93 // }
95 // assure("Error: document doesn't contains pages", nPages > 0);
97 HTMLResult aOutputter = new HTMLResult(_sResult, sBasename + ".html" );
98 aOutputter.header(_sResult);
99 aOutputter.indexSection(sBasename);
101 IniFile aResultIniFile = new IniFile(sResultIniFile);
102 String sStatusRunThrough = aResultIniFile.getValue("global", "state");
103 String sStatusMessage = aResultIniFile.getValue("global", "info");
105 // // TODO: this information has to come out of the ini files
106 // String sStatusRunThrough = "PASSED, ";
107 // String sPassed = "OK";
109 // String sStatusMessage = "From " + nPages + " page(s) are: ";
110 // String sGood = "";
111 // String sBad = "";
112 // String sUgly = "";
114 // if (good > 0)
115 // {
116 // sGood = " good:=" + good;
117 // sStatusMessage += sGood;
118 // }
119 // if (bad > 0)
120 // {
121 // sBad = " bad:=" + bad;
122 // sStatusMessage += sBad;
123 // }
124 // if (ugly > 0)
125 // {
126 // sUgly = " ugly:=" + ugly;
127 // sStatusMessage += sUgly;
128 // }
130 // // Failure matrix
131 // // 0 1
132 // // ugly OK FAILED
133 // // bad OK
134 // // good OK
136 // if (ugly > 0)
137 // {
138 // sPassed = "FAILED";
139 // }
140 // else
141 // {
142 // if (bad > 0)
143 // {
144 // sPassed = "NEED A LOOK";
145 // }
146 // else
147 // {
148 // sPassed = "OK";
149 // }
150 // }
151 // sStatusRunThrough += sPassed;
152 // aResultIniFile.insertValue("global", "state", sStatusRunThrough);
153 // aResultIniFile.insertValue("global", "info", sStatusMessage);
154 // aResultIniFile.close();
156 String sHTMLFile = _aParams.getHTMLPrefix(); // "http://so-gfxcmp-lin/gfxcmp_ui/cw.php?inifile=";
157 sHTMLFile += _sDocument + ".ini";
158 aOutputter.indexLine(sHTMLFile, sBasename, sStatusRunThrough, sStatusMessage);
159 aOutputter.close();
160 // IniFile aIniFile = new IniFile(_sDocument);
161 // aIniFile.