tests/auto/qpalette/tst_qpalette.cpp
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the test suite of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 
       
    43 #include <QtTest/QtTest>
       
    44 
       
    45 #include "qpalette.h"
       
    46 #include <qapplication.h>
       
    47 
       
    48 //TESTED_CLASS=QPalette
       
    49 //TESTED_FILES=qpalette.h qpalette.cpp
       
    50 
       
    51 class tst_QPalette : public QObject
       
    52 {
       
    53 Q_OBJECT
       
    54 
       
    55 public:
       
    56     tst_QPalette();
       
    57     virtual ~tst_QPalette();
       
    58 
       
    59 public slots:
       
    60     void initTestCase();
       
    61     void cleanupTestCase();
       
    62     void init();
       
    63     void cleanup();
       
    64 
       
    65 private slots:
       
    66     void roleValues_data();
       
    67     void roleValues();
       
    68 };
       
    69 
       
    70 tst_QPalette::tst_QPalette()
       
    71 {
       
    72 }
       
    73 
       
    74 tst_QPalette::~tst_QPalette()
       
    75 {
       
    76 }
       
    77 
       
    78 void tst_QPalette::initTestCase()
       
    79 {
       
    80 }
       
    81 
       
    82 void tst_QPalette::cleanupTestCase()
       
    83 {
       
    84 }
       
    85 
       
    86 void tst_QPalette::init()
       
    87 {
       
    88 }
       
    89 
       
    90 void tst_QPalette::cleanup()
       
    91 {
       
    92 }
       
    93 
       
    94 void tst_QPalette::roleValues_data()
       
    95 {
       
    96     QTest::addColumn<int>("role");
       
    97     QTest::addColumn<int>("value");
       
    98 
       
    99     QTest::newRow("QPalette::WindowText") << int(QPalette::WindowText) << 0;
       
   100     QTest::newRow("QPalette::Button") << int(QPalette::Button) << 1;
       
   101     QTest::newRow("QPalette::Light") << int(QPalette::Light) << 2;
       
   102     QTest::newRow("QPalette::Midlight") << int(QPalette::Midlight) << 3;
       
   103     QTest::newRow("QPalette::Dark") << int(QPalette::Dark) << 4;
       
   104     QTest::newRow("QPalette::Mid") << int(QPalette::Mid) << 5;
       
   105     QTest::newRow("QPalette::Text") << int(QPalette::Text) << 6;
       
   106     QTest::newRow("QPalette::BrightText") << int(QPalette::BrightText) << 7;
       
   107     QTest::newRow("QPalette::ButtonText") << int(QPalette::ButtonText) << 8;
       
   108     QTest::newRow("QPalette::Base") << int(QPalette::Base) << 9;
       
   109     QTest::newRow("QPalette::Window") << int(QPalette::Window) << 10;
       
   110     QTest::newRow("QPalette::Shadow") << int(QPalette::Shadow) << 11;
       
   111     QTest::newRow("QPalette::Highlight") << int(QPalette::Highlight) << 12;
       
   112     QTest::newRow("QPalette::HighlightedText") << int(QPalette::HighlightedText) << 13;
       
   113     QTest::newRow("QPalette::Link") << int(QPalette::Link) << 14;
       
   114     QTest::newRow("QPalette::LinkVisited") << int(QPalette::LinkVisited) << 15;
       
   115     QTest::newRow("QPalette::AlternateBase") << int(QPalette::AlternateBase) << 16;
       
   116     QTest::newRow("QPalette::NoRole") << int(QPalette::NoRole) << 17;
       
   117     QTest::newRow("QPalette::ToolTipBase") << int(QPalette::ToolTipBase) << 18;
       
   118     QTest::newRow("QPalette::ToolTipText") << int(QPalette::ToolTipText) << 19;
       
   119 
       
   120     // Change this value as you add more roles.
       
   121     QTest::newRow("QPalette::NColorRoles") << int(QPalette::NColorRoles) << 20;
       
   122 }
       
   123 
       
   124 void tst_QPalette::roleValues()
       
   125 {
       
   126     QFETCH(int, role);
       
   127     QFETCH(int, value);
       
   128     QCOMPARE(role, value);
       
   129 }
       
   130 
       
   131 QTEST_MAIN(tst_QPalette)
       
   132 #include "tst_qpalette.moc"