sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/views/ConsoleOutputTest.java
changeset 0 522a326673b6
equal deleted inserted replaced
-1:000000000000 0:522a326673b6
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 package com.symbian.smt.gui.views;
       
    17 
       
    18 import junit.framework.Assert;
       
    19 import org.eclipse.swt.widgets.Display;
       
    20 import org.eclipse.swt.widgets.Shell;
       
    21 import org.junit.Test;
       
    22 
       
    23 
       
    24 public class ConsoleOutputTest {
       
    25 
       
    26 	@Test
       
    27 	public final void testConsoleOutput() {
       
    28 		String textToTest = "Test text";
       
    29 		
       
    30 		Display display = new Display();
       
    31 		Shell shell = new Shell(display);
       
    32 		
       
    33 		ConsoleOutput consoleOutput = new ConsoleOutput();
       
    34 		
       
    35 		consoleOutput.createPartControl(shell);
       
    36 		
       
    37 		consoleOutput.setFocus();  // This method doesn't actually do anything but keeps code coverage happy
       
    38 		
       
    39 		ConsoleOutput.addText(textToTest);
       
    40 		
       
    41 		Assert.assertEquals(ConsoleOutput.getText().substring(0, textToTest.length()), textToTest);
       
    42 		
       
    43 		ConsoleOutput.reset();
       
    44 		
       
    45 		Assert.assertEquals(ConsoleOutput.getText(), "");
       
    46 		
       
    47 		display.dispose();
       
    48 	}
       
    49 }