sysmodelmgr/com.symbian.smt.gui.unittest/src/com/symbian/smt/gui/smtwidgets/ModelLabelsWidgetTest.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.smtwidgets;
       
    17 
       
    18 import static org.junit.Assert.fail;
       
    19 
       
    20 import org.eclipse.swt.SWT;
       
    21 import org.eclipse.swt.widgets.Display;
       
    22 import org.eclipse.swt.widgets.Shell;
       
    23 import org.junit.After;
       
    24 import org.junit.Before;
       
    25 import org.junit.Test;
       
    26 
       
    27 public class ModelLabelsWidgetTest {
       
    28 	Display display;
       
    29 	Shell shell;
       
    30 	ModelLabelsWidget modelLabelsWidget;
       
    31 	/**
       
    32 	 * @throws java.lang.Exception
       
    33 	 */
       
    34 	@Before
       
    35 	public final void setUp() {
       
    36 		display = new Display();
       
    37 		shell = new Shell(display);
       
    38 		
       
    39 		modelLabelsWidget = new ModelLabelsWidget(shell, SWT.NONE);
       
    40 	}
       
    41 
       
    42 	/**
       
    43 	 * @throws java.lang.Exception
       
    44 	 */
       
    45 	@After
       
    46 	public void tearDown() throws Exception {
       
    47 		display.dispose();
       
    48 	}
       
    49 
       
    50 
       
    51 	/**
       
    52 	 * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setDistributionTexts(java.lang.String)}.
       
    53 	 */
       
    54 	@Test
       
    55 	public final void testSetAndGetDistributionText() {
       
    56 		String[] text = {"test"};
       
    57 		
       
    58 		modelLabelsWidget.setDistributionTexts(text);
       
    59 		String[] result = modelLabelsWidget.getDistributionTexts();
       
    60 		
       
    61 		if (result.length != 1 || (!result[0].equals("test"))) {
       
    62 			fail("Distribution Text set\\get failed");
       
    63 		}
       
    64 	}
       
    65 
       
    66 	/**
       
    67 	 * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setModelVersion(java.lang.String)}.
       
    68 	 */
       
    69 	@Test
       
    70 	public final void testSetAndGetModelVersion() {
       
    71 		modelLabelsWidget.setModelVersion("test");
       
    72 		String result = modelLabelsWidget.getModelVersion();
       
    73 		
       
    74 		if (!result.equals("test")) {
       
    75 			fail("Model Version set\\get failed");
       
    76 		}
       
    77 	}
       
    78 
       
    79 	/**
       
    80 	 * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setSystemVersion(java.lang.String)}.
       
    81 	 */
       
    82 	@Test
       
    83 	public final void testSetAndGetSystemVersion() {
       
    84 		modelLabelsWidget.setSystemVersion("test");
       
    85 		String result = modelLabelsWidget.getSystemVersion();
       
    86 		
       
    87 		if (!result.equals("test")) {
       
    88 			fail("System Version set\\get failed");
       
    89 		}
       
    90 	}
       
    91 
       
    92 	/**
       
    93 	 * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setCopyrightText(java.lang.String)}.
       
    94 	 */
       
    95 	@Test
       
    96 	public final void testSetAndGetCopyrightText() {
       
    97 		modelLabelsWidget.setCopyrightText("test");
       
    98 		String result = modelLabelsWidget.getCopyrightText();
       
    99 		
       
   100 		if (!result.equals("test")) {
       
   101 			fail("Copyright Text set\\get failed");
       
   102 		}
       
   103 	}
       
   104 
       
   105 	/**
       
   106 	 * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setModelVersionTexts(java.lang.String)}.
       
   107 	 */
       
   108 	@Test
       
   109 	public final void testSetAndGetModelVersionText() {
       
   110 		String[] text = {"test"};
       
   111 		modelLabelsWidget.setModelVersionTexts(text);
       
   112 		String[] result = modelLabelsWidget.getModelVersionTexts();
       
   113 		
       
   114 		if (result.length != 1 || (! result[0].equals("test"))) {
       
   115 			fail("Model Version Text set\\get failed");
       
   116 		}
       
   117 	}
       
   118 
       
   119 	/**
       
   120 	 * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setModelName(java.lang.String)}.
       
   121 	 */
       
   122 	@Test
       
   123 	public final void testSetAndGetModelName() {
       
   124 		modelLabelsWidget.setModelName("test");
       
   125 		String result = modelLabelsWidget.getModelName();
       
   126 		
       
   127 		if (!result.equals("test")) {
       
   128 			fail("Model Name set\\get failed");
       
   129 		}
       
   130 	}
       
   131 
       
   132 	/**
       
   133 	 * Test method for {@link com.symbian.smt.gui.smtwidgets.ModelLabelsWidget#setSystemName(java.lang.String)}.
       
   134 	 */
       
   135 	@Test
       
   136 	public final void testSetAndGetSystemName() {
       
   137 		modelLabelsWidget.setSystemName("test");
       
   138 		String result = modelLabelsWidget.getSystemName();
       
   139 		
       
   140 		if (!result.equals("test")) {
       
   141 			fail("System Name set\\get failed");
       
   142 		}
       
   143 	}
       
   144 
       
   145 }