KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > tidy > JTidyBugsTest


1 /*
2  * Java HTML Tidy - JTidy
3  * HTML parser and pretty printer
4  *
5  * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
6  * Institute of Technology, Institut National de Recherche en
7  * Informatique et en Automatique, Keio University). All Rights
8  * Reserved.
9  *
10  * Contributing Author(s):
11  *
12  * Dave Raggett <dsr@w3.org>
13  * Andy Quick <ac.quick@sympatico.ca> (translation to Java)
14  * Gary L Peskin <garyp@firstech.com> (Java development)
15  * Sami Lempinen <sami@lempinen.net> (release management)
16  * Fabrizio Giustina <fgiust at users.sourceforge.net>
17  *
18  * The contributing author(s) would like to thank all those who
19  * helped with testing, bug fixes, and patience. This wouldn't
20  * have been possible without all of you.
21  *
22  * COPYRIGHT NOTICE:
23  *
24  * This software and documentation is provided "as is," and
25  * the copyright holders and contributing author(s) make no
26  * representations or warranties, express or implied, including
27  * but not limited to, warranties of merchantability or fitness
28  * for any particular purpose or that the use of the software or
29  * documentation will not infringe any third party patents,
30  * copyrights, trademarks or other rights.
31  *
32  * The copyright holders and contributing author(s) will not be
33  * liable for any direct, indirect, special or consequential damages
34  * arising out of any use of the software or documentation, even if
35  * advised of the possibility of such damage.
36  *
37  * Permission is hereby granted to use, copy, modify, and distribute
38  * this source code, or portions hereof, documentation and executables,
39  * for any purpose, without fee, subject to the following restrictions:
40  *
41  * 1. The origin of this source code must not be misrepresented.
42  * 2. Altered versions must be plainly marked as such and must
43  * not be misrepresented as being the original source.
44  * 3. This Copyright notice may not be removed or altered from any
45  * source or altered source distribution.
46  *
47  * The copyright holders and contributing author(s) specifically
48  * permit, without fee, and encourage the use of this source code
49  * as a component for supporting the Hypertext Markup Language in
50  * commercial products. If you use this source code in a product,
51  * acknowledgment is not required but would be appreciated.
52  *
53  */

54 package org.w3c.tidy;
55
56 import java.io.BufferedInputStream JavaDoc;
57 import java.net.URL JavaDoc;
58
59 import org.w3c.dom.Document JavaDoc;
60
61
62 /**
63  * testcase for JTidy resolved bugs.
64  * @author fgiust
65  * @version $Revision: 1.23 $ ($Author: fgiust $)
66  */

67 public class JTidyBugsTest extends TidyTestCase
68 {
69
70     /**
71      * Instantiate a new Test case.
72      * @param name test name
73      */

74     public JTidyBugsTest(String JavaDoc name)
75     {
76         super(name);
77     }
78
79     /**
80      * test for JTidy [475643]: Hex character references not handled.
81      * @throws Exception any exception generated during the test
82      */

83     public void test475643() throws Exception JavaDoc
84     {
85         executeTidyTest("475643.html");
86
87         // no warnings for unknown entities
88
assertNoWarnings();
89     }
90
91     /**
92      * test for JTidy [547976]: Case of attribute values.
93      * @throws Exception any exception generated during the test
94      */

95     public void test547976() throws Exception JavaDoc
96     {
97         executeTidyTest("547976.html");
98     }
99
100     /**
101      * test for JTidy [508245]: Do not convert the & or &lt; to Entity Ref. Actually is "Tidy fails in completing
102      * unclosed tags"
103      * @throws Exception any exception generated during the test
104      */

105     public void test508245() throws Exception JavaDoc
106     {
107         executeTidyTest("508245.html");
108         assertNoErrors();
109     }
110
111     /**
112      * test for JTidy [527118]: Suppress duplicate attributes.
113      * @throws Exception any exception generated during the test
114      */

115     public void test527118() throws Exception JavaDoc
116     {
117         executeTidyTest("527118.html");
118     }
119
120     /**
121      * test for JTidy [531962]: Closing quotes around attribute values.
122      * @throws Exception any exception generated during the test
123      */

124     public void test531962() throws Exception JavaDoc
125     {
126         // wish: missing quote should be detected and handled better:
127
// original: width="10 height="10"
128
// now: width="10 height="
129
// desired: width="10" height="10"
130
executeTidyTest("531962.html");
131     }
132
133     /**
134      * test for JTidy [538727]: setDocType uncorrectly adds "".
135      * @throws Exception any exception generated during the test
136      */

137     public void test538727() throws Exception JavaDoc
138     {
139         //this has the same result of setting it in the config file
140
//tidy.setDocType("\"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"file:///E:/xhtml1-transitional.dtd\"");
141
executeTidyTest("538727.html");
142     }
143
144     /**
145      * test for JTidy [574158]: Error with FONT tag.
146      * @throws Exception any exception generated during the test
147      */

148     public void test574158() throws Exception JavaDoc
149     {
150         executeTidyTest("574158.html");
151     }
152
153     /**
154      * test for JTidy [610244]: NullPointerException in parsing.
155      * @throws Exception any exception generated during the test
156      */

157     public void test610244() throws Exception JavaDoc
158     {
159         executeTidyTest("610244.html");
160     }
161
162     /**
163      * test for JTidy [648768]: Fix for character references &gt;= 32768.
164      * @throws Exception any exception generated during the test
165      */

166     public void test648768() throws Exception JavaDoc
167     {
168         executeTidyTest("648768.html");
169         assertNoWarnings();
170     }
171
172     /**
173      * test for JTidy [791933]: German special character converted to upper case.
174      * @throws Exception any exception generated during the test
175      */

176     public void test791933() throws Exception JavaDoc
177     {
178         executeTidyTest("791933.html");
179     }
180
181     /**
182      * test for JTidy [663197]: nbsp handling is wrong.
183      * @throws Exception any exception generated during the test
184      */

185     public void test663197() throws Exception JavaDoc
186     {
187         executeTidyTest("663197.html");
188     }
189
190     /**
191      * test for JTidy [763191]: Again DOM Parsing error (tidy removes spaces in attribute values).
192      * @throws Exception any exception generated during the test
193      */

194     public void test763191() throws Exception JavaDoc
195     {
196         executeTidyTest("763191.html");
197     }
198
199     /**
200      * test for JTidy [763186]: Another DOM Parsing error (tidy inserting whitespaces).
201      * @throws Exception any exception generated during the test
202      */

203     public void test763186() throws Exception JavaDoc
204     {
205         executeTidyTest("763186.html");
206     }
207
208     /**
209      * test for JTidy [909187]: JTidy should remove 0x0 from stream.
210      * @throws Exception any exception generated during the test
211      */

212     public void test909187() throws Exception JavaDoc
213     {
214         executeTidyTest("909187.html");
215     }
216
217     /**
218      * test for JTidy [917012]: Spaces are moved from content to between tags.
219      * @throws Exception any exception generated during the test
220      */

221     public void test917012() throws Exception JavaDoc
222     {
223         executeTidyTest("917012.html");
224     }
225
226     /**
227      * test for JTidy [922302]: Add comment to script tag to produce valid XML.
228      * @throws Exception any exception generated during the test
229      */

230     public void test922302() throws Exception JavaDoc
231     {
232         executeTidyTest("922302.html");
233     }
234
235     /**
236      * test for JTidy [929936]: escape URLs.
237      * @throws Exception any exception generated during the test
238      */

239     public void test929936() throws Exception JavaDoc
240     {
241         executeTidyTest("929936.html");
242         // 10 escaped "\" or chars
243
assertWarnings(10);
244     }
245
246     /**
247      * test for JTidy [943559]: Form between td. Tidy C mark this as an error, Jtidy adds a useless table.
248      * @throws Exception any exception generated during the test
249      */

250     public void test943559() throws Exception JavaDoc
251     {
252         executeTidyTest("943559.html");
253     }
254
255     /**
256      * test for JTidy [935796]: Quote entities converted to literals.
257      * @throws Exception any exception generated during the test
258      */

259     public void test935796() throws Exception JavaDoc
260     {
261         executeTidyTest("935796.html");
262     }
263
264     /**
265      * test for JTidy [1024661]: Error Parsing duplicate style.
266      * @throws Exception any exception generated during the test
267      */

268     public void test1024661() throws Exception JavaDoc
269     {
270         executeTidyTest("1024661.html");
271     }
272
273     /**
274      * test for JTidy [1039641]: Pre should not change the inside text.
275      * @throws Exception any exception generated during the test
276      */

277     public void test1039641() throws Exception JavaDoc
278     {
279         executeTidyTest("1039641.html");
280     }
281
282     /**
283      * test for JTidy [1058909]: Certain sites causing null pointer Exceptions.
284      * @throws Exception any exception generated during the test
285      */

286     public void test1058909() throws Exception JavaDoc
287     {
288         executeTidyTest("1058909.html");
289     }
290
291 }
Popular Tags