001: /*
002: * Java HTML Tidy - JTidy
003: * HTML parser and pretty printer
004: *
005: * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
006: * Institute of Technology, Institut National de Recherche en
007: * Informatique et en Automatique, Keio University). All Rights
008: * Reserved.
009: *
010: * Contributing Author(s):
011: *
012: * Dave Raggett <dsr@w3.org>
013: * Andy Quick <ac.quick@sympatico.ca> (translation to Java)
014: * Gary L Peskin <garyp@firstech.com> (Java development)
015: * Sami Lempinen <sami@lempinen.net> (release management)
016: * Fabrizio Giustina <fgiust at users.sourceforge.net>
017: *
018: * The contributing author(s) would like to thank all those who
019: * helped with testing, bug fixes, and patience. This wouldn't
020: * have been possible without all of you.
021: *
022: * COPYRIGHT NOTICE:
023: *
024: * This software and documentation is provided "as is," and
025: * the copyright holders and contributing author(s) make no
026: * representations or warranties, express or implied, including
027: * but not limited to, warranties of merchantability or fitness
028: * for any particular purpose or that the use of the software or
029: * documentation will not infringe any third party patents,
030: * copyrights, trademarks or other rights.
031: *
032: * The copyright holders and contributing author(s) will not be
033: * liable for any direct, indirect, special or consequential damages
034: * arising out of any use of the software or documentation, even if
035: * advised of the possibility of such damage.
036: *
037: * Permission is hereby granted to use, copy, modify, and distribute
038: * this source code, or portions hereof, documentation and executables,
039: * for any purpose, without fee, subject to the following restrictions:
040: *
041: * 1. The origin of this source code must not be misrepresented.
042: * 2. Altered versions must be plainly marked as such and must
043: * not be misrepresented as being the original source.
044: * 3. This Copyright notice may not be removed or altered from any
045: * source or altered source distribution.
046: *
047: * The copyright holders and contributing author(s) specifically
048: * permit, without fee, and encourage the use of this source code
049: * as a component for supporting the Hypertext Markup Language in
050: * commercial products. If you use this source code in a product,
051: * acknowledgment is not required but would be appreciated.
052: *
053: */
054: package org.w3c.tidy;
055:
056: import java.io.BufferedInputStream;
057: import java.net.URL;
058:
059: import org.w3c.dom.Document;
060:
061: /**
062: * testcase for JTidy resolved bugs.
063: * @author fgiust
064: * @version $Revision: 1.23 $ ($Author: fgiust $)
065: */
066: public class JTidyBugsTest extends TidyTestCase {
067:
068: /**
069: * Instantiate a new Test case.
070: * @param name test name
071: */
072: public JTidyBugsTest(String name) {
073: super (name);
074: }
075:
076: /**
077: * test for JTidy [475643]: Hex character references not handled.
078: * @throws Exception any exception generated during the test
079: */
080: public void test475643() throws Exception {
081: executeTidyTest("475643.html");
082:
083: // no warnings for unknown entities
084: assertNoWarnings();
085: }
086:
087: /**
088: * test for JTidy [547976]: Case of attribute values.
089: * @throws Exception any exception generated during the test
090: */
091: public void test547976() throws Exception {
092: executeTidyTest("547976.html");
093: }
094:
095: /**
096: * test for JTidy [508245]: Do not convert the & or < to Entity Ref. Actually is "Tidy fails in completing
097: * unclosed tags"
098: * @throws Exception any exception generated during the test
099: */
100: public void test508245() throws Exception {
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: executeTidyTest("527118.html");
111: }
112:
113: /**
114: * test for JTidy [531962]: Closing quotes around attribute values.
115: * @throws Exception any exception generated during the test
116: */
117: public void test531962() throws Exception {
118: // wish: missing quote should be detected and handled better:
119: // original: width="10 height="10"
120: // now: width="10 height="
121: // desired: width="10" height="10"
122: executeTidyTest("531962.html");
123: }
124:
125: /**
126: * test for JTidy [538727]: setDocType uncorrectly adds "".
127: * @throws Exception any exception generated during the test
128: */
129: public void test538727() throws Exception {
130: //this has the same result of setting it in the config file
131: //tidy.setDocType("\"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"file:///E:/xhtml1-transitional.dtd\"");
132: executeTidyTest("538727.html");
133: }
134:
135: /**
136: * test for JTidy [574158]: Error with FONT tag.
137: * @throws Exception any exception generated during the test
138: */
139: public void test574158() throws Exception {
140: executeTidyTest("574158.html");
141: }
142:
143: /**
144: * test for JTidy [610244]: NullPointerException in parsing.
145: * @throws Exception any exception generated during the test
146: */
147: public void test610244() throws Exception {
148: executeTidyTest("610244.html");
149: }
150:
151: /**
152: * test for JTidy [648768]: Fix for character references >= 32768.
153: * @throws Exception any exception generated during the test
154: */
155: public void test648768() throws Exception {
156: executeTidyTest("648768.html");
157: assertNoWarnings();
158: }
159:
160: /**
161: * test for JTidy [791933]: German special character converted to upper case.
162: * @throws Exception any exception generated during the test
163: */
164: public void test791933() throws Exception {
165: executeTidyTest("791933.html");
166: }
167:
168: /**
169: * test for JTidy [663197]: nbsp handling is wrong.
170: * @throws Exception any exception generated during the test
171: */
172: public void test663197() throws Exception {
173: executeTidyTest("663197.html");
174: }
175:
176: /**
177: * test for JTidy [763191]: Again DOM Parsing error (tidy removes spaces in attribute values).
178: * @throws Exception any exception generated during the test
179: */
180: public void test763191() throws Exception {
181: executeTidyTest("763191.html");
182: }
183:
184: /**
185: * test for JTidy [763186]: Another DOM Parsing error (tidy inserting whitespaces).
186: * @throws Exception any exception generated during the test
187: */
188: public void test763186() throws Exception {
189: executeTidyTest("763186.html");
190: }
191:
192: /**
193: * test for JTidy [909187]: JTidy should remove 0x0 from stream.
194: * @throws Exception any exception generated during the test
195: */
196: public void test909187() throws Exception {
197: executeTidyTest("909187.html");
198: }
199:
200: /**
201: * test for JTidy [917012]: Spaces are moved from content to between tags.
202: * @throws Exception any exception generated during the test
203: */
204: public void test917012() throws Exception {
205: executeTidyTest("917012.html");
206: }
207:
208: /**
209: * test for JTidy [922302]: Add comment to script tag to produce valid XML.
210: * @throws Exception any exception generated during the test
211: */
212: public void test922302() throws Exception {
213: executeTidyTest("922302.html");
214: }
215:
216: /**
217: * test for JTidy [929936]: escape URLs.
218: * @throws Exception any exception generated during the test
219: */
220: public void test929936() throws Exception {
221: executeTidyTest("929936.html");
222: // 10 escaped "\" or chars
223: assertWarnings(10);
224: }
225:
226: /**
227: * test for JTidy [943559]: Form between td. Tidy C mark this as an error, Jtidy adds a useless table.
228: * @throws Exception any exception generated during the test
229: */
230: public void test943559() throws Exception {
231: executeTidyTest("943559.html");
232: }
233:
234: /**
235: * test for JTidy [935796]: Quote entities converted to literals.
236: * @throws Exception any exception generated during the test
237: */
238: public void test935796() throws Exception {
239: executeTidyTest("935796.html");
240: }
241:
242: /**
243: * test for JTidy [1024661]: Error Parsing duplicate style.
244: * @throws Exception any exception generated during the test
245: */
246: public void test1024661() throws Exception {
247: executeTidyTest("1024661.html");
248: }
249:
250: /**
251: * test for JTidy [1039641]: Pre should not change the inside text.
252: * @throws Exception any exception generated during the test
253: */
254: public void test1039641() throws Exception {
255: executeTidyTest("1039641.html");
256: }
257:
258: /**
259: * test for JTidy [1058909]: Certain sites causing null pointer Exceptions.
260: * @throws Exception any exception generated during the test
261: */
262: public void test1058909() throws Exception {
263: executeTidyTest("1058909.html");
264: }
265:
266: }
|