1   /*
2    * Created on 26.09.2004
3    *
4    */
5   package org.w3c.tidy.servlet;
6   
7   import com.meterware.httpunit.WebResponse;
8   import com.meterware.httpunit.WebImage;
9   
10  
11  /***
12   *
13   *
14   */
15  public class ValidationImageTagTest extends TidyServletCase
16  {
17  
18      /***
19       * Instantiates a new test case.
20       * @param name test name
21       */
22      public ValidationImageTagTest(String name)
23      {
24          super(name);
25      }
26  
27      /***
28       * Check that image source is set properly in Servlet. do not call the redirector
29       * @throws Exception any axception thrown during test.
30       */
31      public void testAltText() throws Exception
32      {
33          WebResponse response = getResponse();
34  
35          WebImage[] img = response.getImages();
36  
37          assertEquals("Expected 2 images in result.", 2, img.length);
38  
39          assertEquals("Expected my name Page Validation", "Page Validation", img[1].getAltText());
40  
41          String src = img[1].getSource();
42  
43          WebResponse responseImgSrc = getResponse(src + "&srcOnly=true");
44  
45          assertEquals("Image src", Consts.DEFAULT_IMAGE_NAME_PREFIX + "warning.png", responseImgSrc.getText());
46  
47          WebResponse responseImg = getResponse(src);
48  
49          assertEquals("Image type", "image/png", responseImg.getContentType());
50  
51      }
52  }