⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowforawtwindowtest.java

📁 基于Junit的 功能和单元测试的的测试工具。只支持Swing.
💻 JAVA
字号:
package org.uispec4j;

import junit.framework.AssertionFailedError;
import org.uispec4j.xml.XmlAssert;

import javax.swing.JMenuBar;
import javax.swing.JTextField;
import java.awt.Frame;

public class WindowForAwtWindowTest extends WindowTestCase {
  public void test() throws Exception {
    Window window = createWindow();
    assertEquals("", window.getTitle());
  }

  public void testWindowManagesMenuBars() throws Exception {
    // not supported
  }

  public void testGetTitle() throws Exception {
    assertEquals("", createWindow().getTitle());
  }

  public void testAssertTitleEquals() throws Exception {
    final Window window = createWindow();
    assertTrue(window.titleEquals(""));
    checkAssertionFails(window.titleEquals("title"),
                        "expected:<title> but was:<>");
  }

  public void testGetDescription() throws Exception {
    Window window = createWindow();
    window.getAwtComponent().setName("myFrame");

    JTextField textField = new JTextField();
    textField.setName("myText");
    addComponent(window, textField);

    XmlAssert.assertEquivalent("<window title=''>" +
                               "  <textBox name='myText'/>" +
                               "</window>",
                               window.getDescription());
  }

  protected Window createWindowWithMenu(JMenuBar jMenuBar) {
    throw new AssertionFailedError("not supported");
  }

  protected Window createWindowWithTitle(String title) {
    throw new AssertionFailedError("not supported");
  }

  protected void close(Window window) {
    java.awt.Window awtWindow = (java.awt.Window)window.getAwtComponent();
    awtWindow.setVisible(false);
  }

  protected UIComponent createComponent() {
    return createWindow();
  }

  protected Window createWindow() {
    java.awt.Window awtWindow = new java.awt.Window(new Frame());
    return new Window(awtWindow);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -