qcpix/tsrc/qtcpixunittests/src/ut_qtcpixdocumentfield.cpp
changeset 0 671dee74050a
child 13 fcb2a58c181b
equal deleted inserted replaced
-1:000000000000 0:671dee74050a
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include "ut_qtcpixdocumentfield.h"
       
    19 #include "../../QtTestUtil/QtTestUtil.h"
       
    20 
       
    21 #include <qcpixdocumentfield.h>
       
    22 
       
    23 void QCPixDocumentFieldTester::testNewInstance()
       
    24     {
       
    25     QCPixDocumentField* field = QCPixDocumentField::newInstance( QString(), QString(), 0 );
       
    26     QVERIFY( field != NULL );
       
    27     }
       
    28 
       
    29 void QCPixDocumentFieldTester::testGetSetName_data()
       
    30     {
       
    31     QTest::addColumn< QString >( "name" );
       
    32     
       
    33     QTest::newRow("testName") << "testName" ;
       
    34     QTest::newRow("testName2") << "testName2" ;
       
    35     }
       
    36 
       
    37 void QCPixDocumentFieldTester::testGetSetName()
       
    38     {
       
    39     QFETCH( QString, name );
       
    40     iField->setName( name );
       
    41     QVERIFY( iField->name() == name );
       
    42     }
       
    43 
       
    44 void QCPixDocumentFieldTester::testGetSetValue_data()
       
    45     {
       
    46     QTest::addColumn< QString >( "value" );
       
    47     
       
    48     QTest::newRow("testValue") << "testValue" ;
       
    49     QTest::newRow("testVlaue2") << "testValue2" ;
       
    50     }
       
    51 
       
    52 void QCPixDocumentFieldTester::testGetSetValue()
       
    53     {
       
    54     QFETCH( QString, value );
       
    55     iField->setValue( value );
       
    56     QVERIFY( iField->value() == value );
       
    57     }
       
    58 
       
    59 void QCPixDocumentFieldTester::testGetSetConfig_data()
       
    60     {
       
    61     QTest::addColumn< int >( "config" );
       
    62     
       
    63     QTest::newRow("10") << 10 ;
       
    64     QTest::newRow("20") << 20 ;
       
    65     }
       
    66 
       
    67 void QCPixDocumentFieldTester::testGetSetConfig()
       
    68     {
       
    69     QFETCH( int, config );
       
    70     iField->setConfig( config );
       
    71     QVERIFY( iField->config() == config );
       
    72     }
       
    73 
       
    74 void QCPixDocumentFieldTester::init()
       
    75     {
       
    76     iField = QCPixDocumentField::newInstance( "testName", "testValue", 100 );
       
    77     QVERIFY( iField!=NULL && iField->name()=="testName" && iField->value()=="testValue" && iField->config()==100 );
       
    78     }
       
    79 
       
    80 void QCPixDocumentFieldTester::cleanup()
       
    81     {
       
    82     delete iField;
       
    83     }
       
    84 
       
    85 QTTESTUTIL_REGISTER_TEST( QCPixDocumentFieldTester );