1 19 20 33 package org.htmlparser.tests.scannersTests; 34 35 import org.htmlparser.scanners.FrameScanner; 36 import org.htmlparser.tags.FrameTag; 37 import org.htmlparser.tests.ParserTestCase; 38 import org.htmlparser.util.ParserException; 39 40 public class FrameScannerTest extends ParserTestCase 41 { 42 43 public FrameScannerTest(String name) 44 { 45 super(name); 46 } 47 48 public void testScan() throws ParserException 49 { 50 createParser( 51 "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n" 52 + "<frame name=\"topFrame\" noresize SRC=\"demo_bc_top.html\" scrolling=\"NO\" frameborder=\"NO\">\n" 53 + "<frame name=\"mainFrame\" SRC=\"http://www.kizna.com/web_e/\" scrolling=\"AUTO\">\n" 54 + "</frameset>", 55 "http://www.google.com/test/index.html"); 56 57 parser.addScanner(new FrameScanner("")); 58 59 parseAndAssertNodeCount(4); 60 61 assertTrue("Node 1 should be Frame Tag", node[1] instanceof FrameTag); 62 assertTrue("Node 2 should be Frame Tag", node[2] instanceof FrameTag); 63 64 FrameTag frameTag1 = (FrameTag) node[1]; 65 FrameTag frameTag2 = (FrameTag) node[2]; 66 assertEquals( 67 "Frame 1 Locn", 68 "http://www.google.com/test/demo_bc_top.html", 69 frameTag1.getFrameLocation()); 70 assertEquals("Frame 1 Name", "topFrame", frameTag1.getFrameName()); 71 assertEquals( 72 "Frame 2 Locn", 73 "http://www.kizna.com/web_e/", 74 frameTag2.getFrameLocation()); 75 assertEquals("Frame 2 Name", "mainFrame", frameTag2.getFrameName()); 76 assertEquals( 77 "Frame 1 Scrolling", 78 "NO", 79 frameTag1.getAttribute("scrolling")); 80 assertEquals( 81 "Frame 1 Border", 82 "NO", 83 frameTag1.getAttribute("frameborder")); 84 } 85 } 86 | Popular Tags |