1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Add a test for secondary build console

This commit is contained in:
Anton Leherbauer 2007-01-31 10:21:27 +00:00
parent 43d2e77123
commit 3ae81bb32f
2 changed files with 70 additions and 0 deletions

View file

@ -16,6 +16,7 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.refactoring.tests.RenameRegressionTests;
import org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests;
import org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyTestSuite;
import org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite;
import org.eclipse.cdt.ui.tests.text.TextTestSuite;
@ -69,6 +70,9 @@ public class AutomatedSuite extends TestSuite {
// tests from package org.eclipse.cdt.ui.tests.text.selection
addTest(SelectionTestSuite.suite());
// tests from package org.eclipse.cdt.ui.tests.buildconsole
addTest(BuildConsoleTests.suite());
}
}

View file

@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others.
* 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:
* Anton Leherbauer (Wind River Systems) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.tests.buildconsole;
import java.io.IOException;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IBuildConsoleManager;
import org.eclipse.cdt.ui.tests.BaseUITestCase;
import org.eclipse.cdt.ui.tests.text.DisplayHelper;
/**
* BuildConsoleTests.
*/
public class BuildConsoleTests extends BaseUITestCase {
private ICProject fCProject;
public BuildConsoleTests(String name) {
super(name);
}
public static TestSuite suite() {
return new TestSuite(BuildConsoleTests.class);
}
protected void setUp() throws Exception {
super.setUp();
fCProject= CProjectHelper.createCCProject(getName(), "unused", IPDOMManager.ID_FAST_INDEXER);
}
protected void tearDown() throws Exception {
CProjectHelper.delete(fCProject);
fCProject= null;
super.tearDown();
}
public void testSecondaryBuildConsole() throws IOException, CoreException {
IBuildConsoleManager mgr= CUIPlugin.getDefault().getConsoleManager("My Other Console", "cdt.ui.testConsole");
IConsole console= mgr.getConsole(fCProject.getProject());
String stdoutText = "This is stdout\n";
console.getOutputStream().write(stdoutText.getBytes());
String stderrText = "This is stderr\n";
console.getErrorStream().write(stderrText.getBytes());
DisplayHelper.sleep(CUIPlugin.getStandardDisplay(), 200);
IDocument doc= mgr.getConsoleDocument(fCProject.getProject());
assertEquals(stdoutText+stderrText, doc.get());
}
}