Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests
In directory sc8-pr-cvs1:/tmp/cvs-serv8276/org/htmlparser/tests/tagTests
Modified Files:
ImageTagTest.java
Log Message:
Fix bug #755929 Empty string attr. value causes attr parsing to be stopped
and bug #753012 IMG SRC not parsed v1.3 & v1.4
There was a premature break in the attribute scanner on encountering an empty
string value. A guard testing for an exhausted tokenizer was added.
Added testEmptyStringElement() to ImageTagTest, although it could go anywhere really.
Index: ImageTagTest.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/tagTests/ImageTagTest.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** ImageTagTest.java 28 Jun 2003 14:31:25 -0000 1.21
--- ImageTagTest.java 28 Jun 2003 15:08:04 -0000 1.22
***************
*** 200,202 ****
--- 200,220 ----
assertNotNull ("no image tag", img);
}
+
+ /**
+ * See bug #755929 Empty string attr. value causes attr parsing to be stopped
+ * and bug #753012 IMG SRC not parsed v1.3 & v1.4
+ */
+ public void testEmptyStringElement () throws ParserException
+ {
+ String html = "<img height=\"1\" width=\"1\" alt=\"\" "
+ + "src=\"http://i.cnn.net/cnn/images/1.gif\"/>";
+
+ createParser (html);
+ parser.registerScanners ();
+
+ parseAndAssertNodeCount (1);
+ assertTrue ("Node should be an ImageTag", node[0] instanceof ImageTag);
+ ImageTag img = (ImageTag)node[0];
+ assertTrue ("bad source", "http://i.cnn.net/cnn/images/1.gif".equals (img.getImageURL ()));
+ }
}
|