windowforjframetest.java

来自「基于Junit的 功能和单元测试的的测试工具。只支持Swing.」· Java 代码 · 共 36 行

JAVA
36
字号
package org.uispec4j;

import junit.framework.AssertionFailedError;
import org.uispec4j.utils.AssertionFailureNotDetectedError;

import javax.swing.*;

public class WindowForJFrameTest extends WindowTestCase {

  public void testIsModal() throws Exception {
    Window window = new Window(new JFrame());
    assertFalse(window.isModal());
    try {
      assertTrue(window.isModal());
      throw new AssertionFailureNotDetectedError();
    }
    catch (AssertionFailedError e) {
    }
  }

  protected Window createWindowWithMenu(JMenuBar jMenuBar) {
    JFrame frame = new JFrame();
    frame.setJMenuBar(jMenuBar);
    return new Window(frame);
  }

  protected Window createWindowWithTitle(String title) {
    return new Window(new JFrame(title));
  }

  protected void close(Window window) {
    JFrame frame = (JFrame)window.getAwtContainer();
    frame.dispose();
  }
}

⌨️ 快捷键说明

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