1 /*
2  * ************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
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.
15  *
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).
21  *
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.
26  *
27  * ***********************************************************************
28  */
29 
30 package graphical;
31 
32 // import java.io.File;
33 
34 /**
35  *
36  * @author ll93751
37  */
38 public class JPEGEvaluator extends EnhancedComplexTestCase
39 {
40     // @Override
41     public String[] getTestMethodNames()
42     {
43         return new String[]{"EvaluateResult"};
44     }
45 
46     /**
47      * test function.
48      */
49     public void EvaluateResult()
50     {
51         GlobalLogWriter.set(log);
52         ParameterHelper aParam = new ParameterHelper(param);
53 
54         // aParam.getTestParameters().put("current_ok_status", -1);
55 
56         // run through all documents found in Inputpath
57         foreachResultCreateHTML(aParam);
58     }
59 
60     public void checkOneFile(String _sDocument, String _sResult, ParameterHelper _aParams) throws OfficeException
61     {
62         // throw new UnsupportedOperationException("Not supported yet.");
63         // int dummy = 0;
64 
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());
69 //
70 //        int good = 0;
71 //        int bad = 0;
72 //        int ugly = 0;
73 //
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 //        }
93 //
94 //        assure("Error: document doesn't contains pages", nPages > 0);
95 
96         HTMLResult aOutputter = new HTMLResult(_sResult, sBasename + ".html" );
97         aOutputter.header(_sResult);
98         aOutputter.indexSection(sBasename);
99 
100         IniFile aResultIniFile = new IniFile(sResultIniFile);
101         String sStatusRunThrough = aResultIniFile.getValue("global", "state");
102         String sStatusMessage = aResultIniFile.getValue("global", "info");
103 
104 //        // TODO: this information has to come out of the ini files
105 //        String sStatusRunThrough = "PASSED, ";
106 //        String sPassed = "OK";
107 //
108 //        String sStatusMessage = "From " + nPages + " page(s) are: ";
109 //        String sGood = "";
110 //        String sBad = "";
111 //        String sUgly = "";
112 //
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 //        }
128 //
129 //        // Failure matrix
130 //        //         0     1
131 //        // ugly    OK    FAILED
132 //        // bad     OK
133 //        // good    OK
134 //
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();
154 
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.
161 
162     }
163 
164 
165 }
166