📄 windowforawtwindowtest.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 + -