+ /**
+ * Test the legend content
+ */
+ @Test
+ public void testLegend() {
+ String[] labelValues = { "UNKNOWN", "WAIT_UNKNOWN", "WAIT_BLOCKED", "WAIT_FOR_CPU", "USERMODE", "SYSCALL", "INTERRUPTED" };
+ SWTBotToolbarButton legendButton = fViewBot.toolbarButton("Show Legend");
+ legendButton.click();
+ fBot.waitUntil(org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive("States Transition Visualizer"));
+ SWTBot bot = fBot.activeShell().bot();
+ for (int i = 1; i < 8; i++) {
+ SWTBotLabel label = bot.label(i);
+ assertNotNull(label);
+ assertEquals(labelValues[i - 1], label.getText());
+ }
+ bot.button("OK").click();
+ }
+
+ /**
+ * Test the filter
+ */
+ @Test
+ public void testFilter() {
+ /* change window range to 1 ms */
+ TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(1000000L, ITmfTimestamp.NANOSECOND_SCALE));
+ TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
+ fBot.waitUntil(ConditionHelpers.windowRange(range));
+
+ SWTBotToolbarButton filterButton = fViewBot.toolbarButton("Show View Filters");
+ filterButton.click();
+ fBot.waitUntil(org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive("Filter"));
+ SWTBot bot = fBot.activeShell().bot();
+ SWTBotTree treeBot = bot.tree();
+ TreeCheckedCounter treeCheckCounter = new TreeCheckedCounter(treeBot);
+ // get how many items there are
+ Integer checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals("default", 200, checked.intValue());
+ // test "uncheck all button"
+ bot.button(UNCHECK_ALL).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(0, checked.intValue());
+ // test check active
+ bot.button(CHECK_ACTIVE).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(CHECK_ACTIVE, 43, checked.intValue());
+ // test check all
+ bot.button(CHECK_ALL).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(CHECK_ALL, 200, checked.intValue());
+ // test uncheck inactive
+ bot.button(UNCHECK_INACTIVE).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(UNCHECK_INACTIVE, 43, checked.intValue());
+ // test check selected
+ treeBot.select(1);
+ bot.button(UNCHECK_ALL).click();
+ bot.button(CHECK_SELECTED).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(CHECK_SELECTED, 1, checked.intValue());
+ // test check subtree
+ bot.button(UNCHECK_ALL).click();
+ bot.button(CHECK_SUBTREE).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(CHECK_SUBTREE, 1, checked.intValue());
+ // test uncheck selected
+ bot.button(CHECK_ALL).click();
+ bot.button(UNCHECK_SELECTED).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(UNCHECK_SELECTED, 199, checked.intValue());
+ // test uncheck subtree
+ bot.button(CHECK_ALL).click();
+ bot.button(UNCHECK_SUBTREE).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(UNCHECK_SELECTED, 199, checked.intValue());
+ // test filter
+ bot.button(UNCHECK_ALL).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals(0, checked.intValue());
+ bot.text().setText("half-life 3");
+ fBot.waitUntil(org.eclipse.swtbot.swt.finder.waits.Conditions.treeHasRows(treeBot, 25));
+ bot.button(CHECK_ALL).click();
+ checked = UIThreadRunnable.syncExec(treeCheckCounter);
+ assertEquals("Filtered", 25, checked.intValue());
+ bot.button("OK").click();
+ treeBot = fViewBot.bot().tree();
+ for (int i = 0; i < 25; i++) {
+ assertEquals("Filtered Control flow view", "Half-life 3", treeBot.cell(i, 0));
+ }
+ }
+