blob: 0405fee441d7e183e4141e4f1affb7726bd169c6 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010 SAP AG, Walldorf.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* SAP AG - initial API and implementation
*******************************************************************************/
package org.eclipse.platform.discovery.ui.test.comp.internal;
import org.eclipse.platform.discovery.testutils.utils.abbot.AbstractUITest;
import org.eclipse.platform.discovery.testutils.utils.abbot.IAbbotTestUiStarter;
import org.eclipse.platform.discovery.testutils.utils.abbot.matchers.ToolItemMatcher;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolItem;
import abbot.swt.finder.generic.MultipleFoundException;
import abbot.swt.finder.generic.NotFoundException;
import abbot.swt.tester.ButtonTester;
import abbot.swt.tester.ComboTester;
import abbot.swt.tester.TextTester;
import abbot.swt.tester.ToolItemTester;
import abbot.swt.tester.TreeItemTester;
import abbot.swt.tester.TreeTester;
public class DicoveryViewTestFixture extends AbstractUITest
{
protected Shell testShell;
protected final String TEST_SHELL_TEXT = "TEST SHELL";
protected ComboTester comboTester;
protected TextTester textTester;
protected TreeTester treeTester;
protected TreeItemTester treeItemTester;
protected ButtonTester buttonTester;
protected ToolItemTester toolItemTester;
@Override
public Display setUpPDE() throws Exception
{
super.setUpPDE();
comboTester = ComboTester.getComboTester();
treeTester = TreeTester.getTreeTester();
treeItemTester = TreeItemTester.getTreeItemTester();
textTester = TextTester.getTextTester();
buttonTester = ButtonTester.getButtonTester();
toolItemTester = ToolItemTester.getToolItemTester();
return getDisplay();
}
@Override
protected IAbbotTestUiStarter getUiStarter()
{
if (testShell == null || testShell.isDisposed())
{
return null;
}
return new IAbbotTestUiStarter()
{
public void closeEnclosingDialog(Display display)
{
display.syncExec(new Runnable()
{
public void run()
{
testShell.close();
}
});
}
};
}
protected Shell createTestShell()
{
final Shell[] shell = new Shell[1];
getDisplay().syncExec(new Runnable()
{
public void run()
{
shell[0] = new Shell(getDisplay());
shell[0].setText(TEST_SHELL_TEXT);
}
});
return shell[0];
}
@Override
public void tearDownPDE() throws Exception
{
super.tearDownPDE();
testShell = null;
}
protected ToolItem getMonitorCancelButton() throws NotFoundException, MultipleFoundException
{
return (ToolItem) FINDER.find(new ToolItemMatcher(testShell,getDisplay()));
}
}