?? testimageprimitive.java
字號:
package com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.ContentElements;import junit.framework.*;import com.wiley.compBooks.EJwithUML.Base.TestUtilities.*;import com.wiley.compBooks.EJwithUML.Base.HtmlPrimitives.Core.*;import java.io.*;public class TestImagePrimitive extends TestCase{ private TestFileSet testFileSet; public TestImagePrimitive(String name) throws IOException { super(name); testFileSet = new TestFileSet("C:/EJwithUML2e/UnitTestResults/HtmlPrimitives/ContentElements/ImagePrimitive/"); } public void testSimpleImage() throws IOException { StringBuffer buffer = new StringBuffer(); ImagePrimitive image = new ImagePrimitive("./pic.jpg"); image.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("SimpleImage.html", buffer.toString()); assertEquals("SimpleImage", match, true); } public void testSizedImage() throws IOException { StringBuffer buffer = new StringBuffer(); ImagePrimitive image = new ImagePrimitive("./pic.jpg"); image.setSize(50, 50); image.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("SizedImage.html", buffer.toString()); assertEquals("SizedImage", match, true); } public void testAlternateTextImage() throws IOException { StringBuffer buffer = new StringBuffer(); ImagePrimitive image = new ImagePrimitive("./pic.jpg"); image.setAlternateText("A fairly pointless but hopefully diverting picture."); image.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("AlternateText.html", buffer.toString()); assertEquals("AlternateText", match, true); } public void testStyledImage() throws IOException { StringBuffer buffer = new StringBuffer(); ImagePrimitive image = new ImagePrimitive("./pic.jpg"); image.setStyle(Style.NORMAL_IMAGE); image.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("StyledImage.html", buffer.toString()); assertEquals("StyledImage", match, true); } public void testComplexImage() throws IOException { StringBuffer buffer = new StringBuffer(); ImagePrimitive image = new ImagePrimitive("./pic.jpg"); image.setAlternateText("A fairly pointless but hopefully diverting picture."); image.setSize(50,50); image.setStyle(Style.NORMAL_IMAGE); image.buildContent(buffer); boolean match = testFileSet.fileMatchesGold("ComplexImage.html", buffer.toString()); assertEquals("ComplexImage", match, true); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -