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

📄 popupmenuinterceptiontest.java

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

import org.uispec4j.Trigger;

import javax.swing.*;

public class PopupMenuInterceptionTest extends InterceptionTestCase {
  public void test() throws Exception {
    String[] items = {"item 1", "item 2"};
    PopupMenuInterceptor
      .run(new PopupTrigger(items))
      .contentEquals(items);
  }

  private static class PopupTrigger implements Trigger {
    JPopupMenu popup = new JPopupMenu();

    public PopupTrigger(String[] items) {
      for (int i = 0; i < items.length; i++) {
        popup.add(items[i]);
      }
    }

    public void run() throws Exception {
      popup.show(null, 100, 100);
    }
  }
}

⌨️ 快捷键说明

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