/** Import a gzip trace */
  @Test
  public void testGzipImport() {
    final String traceType = "Test trace : TMF Tests";
    final String tracesNode = "Traces [1]";

    /*
     * Actual importing
     */
    openImportWizard();
    selectImportFromArchive(fGzipTrace.getAbsolutePath());
    selectFolder(ROOT_FOLDER);
    SWTBotCheckBox checkBox = fBot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace);
    assertFalse(checkBox.isEnabled());
    SWTBotCombo comboBox = fBot.comboBoxWithLabel(Messages.ImportTraceWizard_TraceType);
    comboBox.setSelection(traceType);
    importFinish();
    /*
     * Remove .gz extension
     */
    assertNotNull(fGzipTrace);
    String name = fGzipTrace.getName();
    assertNotNull(name);
    assertTrue(name.length() > 3);
    String traceName = name.substring(0, name.length() - 3);
    assertNotNull(traceName);
    assertFalse(traceName.isEmpty());

    /*
     * Open trace
     */
    SWTBotView projectExplorer = fBot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
    projectExplorer.setFocus();
    final SWTBotTree tree = projectExplorer.bot().tree();
    /*
     * This appears to be problematic due to the length of the file name and
     * the resolution in our CI.
     */
    tree.expandNode(PROJECT_NAME, true);
    SWTBotTreeItem treeItem = tree.getTreeItem(PROJECT_NAME);
    fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(tracesNode, treeItem));
    treeItem = treeItem.getNode(tracesNode);
    fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(traceName, treeItem));
    treeItem = treeItem.getNode(traceName);
    treeItem.doubleClick();
    SWTBotUtils.waitForJobs();
    /*
     * Check results
     */
    SWTBotTable editor = fBot.activeEditor().bot().table();
    String c22 = editor.cell(2, 2);
    String c10 = editor.cell(1, 0);
    assertEquals("Type-1", c22);
    assertEquals("", c10);
  }
Esempio n. 2
0
 public static StagingViewTester openStagingView() throws Exception {
   SWTWorkbenchBot workbenchBot = new SWTWorkbenchBot();
   UIThreadRunnable.syncExec(
       new VoidResult() {
         public void run() {
           try {
             PlatformUI.getWorkbench()
                 .getActiveWorkbenchWindow()
                 .getActivePage()
                 .showView(StagingView.VIEW_ID);
           } catch (Exception e) {
             throw new WidgetNotFoundException(e.getMessage(), e);
           }
         }
       });
   SWTBotView view = workbenchBot.viewById(StagingView.VIEW_ID);
   return new StagingViewTester(view);
 }
Esempio n. 3
0
 /** Test color by making all events yellow */
 @Test
 public void testYellow() {
   SWTBotView viewBot = fBot.viewById(ColorsView.ID);
   viewBot.setFocus();
   final String insert = "Insert new color setting";
   final String increasePriority = "Increase priority";
   final String decreasePriority = "Decrease priority";
   final String delete = "Delete color setting";
   viewBot.toolbarButton(insert).click();
   viewBot.toolbarButton(insert).click();
   viewBot.toolbarButton(insert).click();
   viewBot.toolbarButton(insert).click();
   viewBot.toolbarButton(increasePriority).click();
   viewBot.toolbarButton(decreasePriority).click();
   viewBot.toolbarButton(delete).click();
   viewBot.bot().label(0).setFocus();
   viewBot.toolbarButton(delete).click();
   viewBot.bot().label(0).setFocus();
   viewBot.toolbarButton(delete).click();
   final RGB foreground = new RGB(0, 0, 0);
   final RGB background = new RGB(255, 255, 0);
   // Simulate the side effects of picking a color because we cannot
   // control native Color picker dialog in SWTBot.
   final ColorSetting[] cs = new ColorSetting[1];
   UIThreadRunnable.syncExec(
       new VoidResult() {
         @Override
         public void run() {
           cs[0] = new ColorSetting(foreground, background, foreground, new PassAll());
           ColorSettingsManager.setColorSettings(cs);
         }
       });
   final SWTBotTable eventsEditor = SWTBotUtils.activeEventsEditor(fBot).bot().table();
   // should fix race condition of loading the trace
   SWTBotUtils.waitForJobs();
   eventsEditor.select(2);
   final SWTBotTableItem tableItem = eventsEditor.getTableItem(2);
   RGB fgc =
       UIThreadRunnable.syncExec(
           new Result<RGB>() {
             @Override
             public RGB run() {
               return tableItem.widget.getForeground().getRGB();
             }
           });
   RGB bgc =
       UIThreadRunnable.syncExec(
           new Result<RGB>() {
             @Override
             public RGB run() {
               return tableItem.widget.getBackground().getRGB();
             }
           });
   assertEquals("Fg", foreground, fgc);
   assertEquals("Bg", background, bgc);
   // reset color settings
   UIThreadRunnable.syncExec(
       new VoidResult() {
         @Override
         public void run() {
           ColorSettingsManager.setColorSettings(new ColorSetting[0]);
         }
       });
 }