From 5885d0ac6159a29abbf63475e19ccfc184b77d48 Mon Sep 17 00:00:00 2001 From: Stefan Lay Date: Tue, 1 Mar 2011 22:27:39 +0100 Subject: [historyView] Fix redraw bug with Show all Branches Change-Id: If709597fa5726e230d591b474b07eeca03fd5bc3 Signed-off-by: Stefan Lay Signed-off-by: Matthias Sohn --- .../egit/ui/test/history/HistoryViewTest.java | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history') diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java index 2244525931..4ceed9b955 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java @@ -322,7 +322,28 @@ public class HistoryViewTest extends LocalRepositoryTestCase { final SWTBotTable table = getHistoryViewTable(PROJ1); // check out the second line - table.getTableItem(1).select(); + final RevCommit[] commit = checkoutLine(table, 1); + assertEquals(commit[0].getId().name(), repo.getBranch()); + } + + @Test + public void testShowAllBranches() throws Exception { + toggleShowAllBranchesButton(true); + final SWTBotTable table = getHistoryViewTable(PROJ1); + int commits = getHistoryViewTable(PROJ1).rowCount(); + checkoutLine(table, 1); + + toggleShowAllBranchesButton(false); + assertEquals("Wrong number of commits", commits - 1, + getHistoryViewTable(PROJ1).rowCount()); + toggleShowAllBranchesButton(true); + assertEquals("Wrong number of commits", commits, + getHistoryViewTable(PROJ1).rowCount()); + } + + private RevCommit[] checkoutLine(final SWTBotTable table, int line) + throws InterruptedException { + table.getTableItem(line).select(); final RevCommit[] commit = new RevCommit[1]; Display.getDefault().syncExec(new Runnable() { @@ -337,7 +358,7 @@ public class HistoryViewTest extends LocalRepositoryTestCase { ContextMenuHelper.clickContextMenu(table, UIText.GitHistoryPage_CheckoutMenuLabel); TestUtil.joinJobs(JobFamilies.CHECKOUT); - assertEquals(commit[0].getId().name(), repo.getBranch()); + return commit; } /** @@ -349,4 +370,15 @@ public class HistoryViewTest extends LocalRepositoryTestCase { private static void ensureTableItemLoaded(TableItem item) { item.setText(item.getText()); // TODO: is there a better solution? } + + private void toggleShowAllBranchesButton(boolean checked) throws Exception{ + getHistoryViewTable(PROJ1); + SWTBotView view = bot + .viewById("org.eclipse.team.ui.GenericHistoryView"); + SWTBotToolbarToggleButton showAllBranches = (SWTBotToolbarToggleButton) view + .toolbarButton(UIText.GitHistoryPage_showAllBranches); + boolean isChecked = showAllBranches.isChecked(); + if(isChecked && !checked || !isChecked && checked) + showAllBranches.click(); + } } -- cgit v1.2.3