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  /**
57   * testcase for JTidy resolved bugs.
58   * @author fgiust
59   * @version $Revision: 779 $ ($Author: fgiust $)
60   */
61  public class JTidyBugsTest extends TidyTestCase
62  {
63  
64      /**
65       * Instantiate a new Test case.
66       * @param name test name
67       */
68      public JTidyBugsTest(String name)
69      {
70          super(name);
71      }
72  
73      /**
74       * test for JTidy [475643]: Hex character references not handled.
75       * @throws Exception any exception generated during the test
76       */
77      public void test475643() throws Exception
78      {
79          executeTidyTest("475643.html");
80  
81          // no warnings for unknown entities
82          assertNoWarnings();
83      }
84  
85      /**
86       * test for JTidy [547976]: Case of attribute values.
87       * @throws Exception any exception generated during the test
88       */
89      public void test547976() throws Exception
90      {
91          executeTidyTest("547976.html");
92      }
93  
94      /**
95       * test for JTidy [508245]: Do not convert the & or &lt; to Entity Ref. Actually is "Tidy fails in completing
96       * unclosed tags"
97       * @throws Exception any exception generated during the test
98       */
99      public void test508245() throws Exception
100     {
101         executeTidyTest("508245.html");
102         assertNoErrors();
103     }
104 
105     /**
106      * test for JTidy [527118]: Suppress duplicate attributes.
107      * @throws Exception any exception generated during the test
108      */
109     public void test527118() throws Exception
110     {
111         executeTidyTest("527118.html");
112     }
113 
114     /**
115      * test for JTidy [531962]: Closing quotes around attribute values.
116      * @throws Exception any exception generated during the test
117      */
118     public void test531962() throws Exception
119     {
120         // wish: missing quote should be detected and handled better:
121         // original: width="10 height="10"
122         // now: width="10 height="
123         // desired: width="10" height="10"
124         executeTidyTest("531962.html");
125     }
126 
127     /**
128      * test for JTidy [538727]: setDocType uncorrectly adds "".
129      * @throws Exception any exception generated during the test
130      */
131     public void test538727() throws Exception
132     {
133         // this has the same result of setting it in the config file
134         // tidy.setDocType("\"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"file:///E:/xhtml1-transitional.dtd\"");
135         executeTidyTest("538727.html");
136     }
137 
138     /**
139      * test for JTidy [574158]: Error with FONT tag.
140      * @throws Exception any exception generated during the test
141      */
142     public void test574158() throws Exception
143     {
144         executeTidyTest("574158.html");
145     }
146 
147     /**
148      * test for JTidy [610244]: NullPointerException in parsing.
149      * @throws Exception any exception generated during the test
150      */
151     public void test610244() throws Exception
152     {
153         executeTidyTest("610244.html");
154     }
155 
156     /**
157      * test for JTidy [648768]: Fix for character references &gt;= 32768.
158      * @throws Exception any exception generated during the test
159      */
160     public void test648768() throws Exception
161     {
162         executeTidyTest("648768.html");
163         assertNoWarnings();
164     }
165 
166     /**
167      * test for JTidy [791933]: German special character converted to upper case.
168      * @throws Exception any exception generated during the test
169      */
170     public void test791933() throws Exception
171     {
172         executeTidyTest("791933.html");
173     }
174 
175     /**
176      * test for JTidy [663197]: nbsp handling is wrong.
177      * @throws Exception any exception generated during the test
178      */
179     public void test663197() throws Exception
180     {
181         executeTidyTest("663197.html");
182     }
183 
184     /**
185      * test for JTidy [763191]: Again DOM Parsing error (tidy removes spaces in attribute values).
186      * @throws Exception any exception generated during the test
187      */
188     public void test763191() throws Exception
189     {
190         executeTidyTest("763191.html");
191     }
192 
193     /**
194      * test for JTidy [763186]: Another DOM Parsing error (tidy inserting whitespaces).
195      * @throws Exception any exception generated during the test
196      */
197     public void test763186() throws Exception
198     {
199         executeTidyTest("763186.html");
200     }
201 
202     /**
203      * test for JTidy [909187]: JTidy should remove 0x0 from stream.
204      * @throws Exception any exception generated during the test
205      */
206     public void test909187() throws Exception
207     {
208         executeTidyTest("909187.html");
209     }
210 
211     /**
212      * test for JTidy [917012]: Spaces are moved from content to between tags.
213      * @throws Exception any exception generated during the test
214      */
215     public void test917012() throws Exception
216     {
217         executeTidyTest("917012.html");
218     }
219 
220     /**
221      * test for JTidy [922302]: Add comment to script tag to produce valid XML.
222      * @throws Exception any exception generated during the test
223      */
224     public void test922302() throws Exception
225     {
226         executeTidyTest("922302.html");
227     }
228 
229     /**
230      * test for JTidy [929936]: escape URLs.
231      * @throws Exception any exception generated during the test
232      */
233     public void test929936() throws Exception
234     {
235         executeTidyTest("929936.html");
236         // 10 escaped "\" or chars
237         assertWarnings(10);
238     }
239 
240     /**
241      * test for JTidy [943559]: Form between td. Tidy C mark this as an error, Jtidy adds a useless table.
242      * @throws Exception any exception generated during the test
243      */
244     public void test943559() throws Exception
245     {
246         executeTidyTest("943559.html");
247     }
248 
249     /**
250      * test for JTidy [935796]: Quote entities converted to literals.
251      * @throws Exception any exception generated during the test
252      */
253     public void test935796() throws Exception
254     {
255         executeTidyTest("935796.html");
256     }
257 
258     /**
259      * test for JTidy [1024661]: Error Parsing duplicate style.
260      * @throws Exception any exception generated during the test
261      */
262     public void test1024661() throws Exception
263     {
264         executeTidyTest("1024661.html");
265     }
266 
267     /**
268      * test for JTidy [1039641]: Pre should not change the inside text.
269      * @throws Exception any exception generated during the test
270      */
271     public void test1039641() throws Exception
272     {
273         executeTidyTest("1039641.html");
274     }
275 
276     /**
277      * test for JTidy [1058909]: Certain sites causing null pointer Exceptions.
278      * @throws Exception any exception generated during the test
279      */
280     public void test1058909() throws Exception
281     {
282         executeTidyTest("1058909.html");
283     }
284 
285     /**
286      * test for JTidy [1097062]: trimInitialSpace does not handle nested inlines.
287      * @throws Exception any exception generated during the test
288      */
289     public void test1097062() throws Exception
290     {
291         executeTidyTest("1097062.html");
292     }
293 
294 }