-
Notifications
You must be signed in to change notification settings - Fork 239
Open
Labels
bugSomething isn't workingSomething isn't working
Description
@Test
public void disposeTab() throws PartInitException {
FormEditorMock.hook = FormEditorMock.DEFAULT_HOOK;
FormEditorMock subject = (FormEditorMock) WORKBENCH.getActiveWorkbenchWindow().getActivePage().openEditor(input,
FormEditorMock.ID);
dispatch(subject);
CTabItem[] tabs = subject.leakContainer().getItems();
assertEquals(1, tabs.length);
FormPage page1 = addPage(subject, "page1");
assertSame(page1, subject.findPage("page1"));
tabs = subject.leakContainer().getItems();
assertEquals(2, tabs.length);
tabs[tabs.length - 1].dispose();
dispatch(subject);
tabs = subject.leakContainer().getItems();
assertEquals(1, tabs.length);
// BUG
// assertNull(subject.findPage("page1"));
}
@Test
public void maintainIntegrityOnPageClose() throws PartInitException {
FormEditorMock.hook = new Hook() {
@Override
public void createContainer(FormEditorMock subject, CTabFolder container) {
Hook.super.createContainer(subject, container);
container.setUnselectedCloseVisible(true);
}
@Override
public void createItem(FormEditorMock subject, CTabItem item) {
Hook.super.createItem(subject, item);
item.setShowClose(true);
}
};
FormEditorMock subject = (FormEditorMock) WORKBENCH.getActiveWorkbenchWindow().getActivePage().openEditor(input,
FormEditorMock.ID);
FormPage page1 = addPage(subject, "page1");
CTabFolder tabFolder = subject.leakContainer();
CTabItem tab = tabFolder.getItem(1);
assertTrue(tab.getShowClose());
assertSame(page1, subject.findPage("page1"));
Event event = new Event();
event.type = SWT.MouseDown;
event.button = 1;
event.x = tab.getBounds().x + tab.getBounds().width - 9;
event.y = tab.getBounds().y + tab.getBounds().height/2;
tabFolder.notifyListeners(event.type, event);
dispatch(subject);
event.type = SWT.MouseUp;
tabFolder.notifyListeners(event.type, event);
dispatch(subject);
assertEquals(1, tabFolder.getItems().length);
// BUG
// assertNull(subject.findPage("page1"));
}To reproduce, pull from #3765 and uncomment BUG lines.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working