public void testMethodCallInSuper() throws Exception {
   // todo[yole] make this test work in headless
   if (!GraphicsEnvironment.isHeadless()) {
     Class cls = loadAndPatchClass("TestMethodCallInSuper.form", "MethodCallInSuperTest");
     JDialog instance = (JDialog) cls.newInstance();
     assertEquals(1, instance.getContentPane().getComponentCount());
   }
 }
 @Test
 public void test_main_online() throws IOException {
   URL online = new URL("http://luckydonald.github.io/OfflineData.bin");
   if (GraphicsEnvironment.isHeadless()) {
     this.binFileReader = new BinFileReader(online);
   } else {
     this.binFileReader = new BinFileReaderGui(online);
   }
   do_read_from_bin();
 }
 @Test
 public void test_main_offline() throws IOException {
   File offline = new File("OfflineData.bin");
   if (offline.exists() && !offline.isDirectory()) {
     this.getLogger().info("OfflineData.bin file exists.");
     if (GraphicsEnvironment.isHeadless()) {
       this.binFileReader = new BinFileReader(offline);
     } else {
       this.binFileReader = new BinFileReaderGui(offline);
     }
     do_read_from_bin();
     System.out.println("");
   } else {
     getLogger().warning("No OfflineData.bin file!");
   }
 }
Esempio n. 4
0
  static {
    //  Do not initialize keyboard settings
    //  if we are running headless.

    try {
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

      if (!ge.isHeadless()) {
        MENU_SHORTCUT_KEY_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();

        MENU_SHORTCUT_SHIFT_KEY_MASK = MENU_SHORTCUT_KEY_MASK + InputEvent.SHIFT_MASK;
      } else {
        MENU_SHORTCUT_KEY_MASK = 0;
        MENU_SHORTCUT_SHIFT_KEY_MASK = 0;
      }
    } catch (Exception e) {
    }
  }
 public void do_read_from_bin() throws IOException {
   Database db = new Database();
   DBEntry foo = binFileReader.readNextEntry(db);
   ArrayList<BinFileReadLogger> loggerz = binFileReader.getLoggerz();
   long endPos = -1;
   this.getLogger();
   for (BinFileReadLogger log : loggerz) {
     endPos = log.getEndPosition();
     // System.out.println(log);
   }
   if (!GraphicsEnvironment.isHeadless()) {
     ((BinFileReaderGui) binFileReader).updateHex();
   }
   System.out.println(foo.toSimpleString());
   if (endPos < 499796) {
     // Le fail.
     this.getLogger()
         .warning("Didn't read the complete file. Read " + endPos + " of 499796 bytes.");
   }
 }
Esempio n. 6
0
 static {
   guiAvailable = !GraphicsEnvironment.isHeadless();
 }