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