Home

testqstring.cpp Example File
tutorial2/testqstring.cpp

    /***************************************************************************
    ** This file may be distributed under the terms of the Q Public License
    ** as defined by Trolltech AS of Norway and appearing in the file
    ** LICENSE.QPL included in the packaging of this file.
    **
    ** This file may be distributed and/or modified under the terms of the
    ** GNU General Public License version 2 as published by the Free Software
    ** Foundation and appearing in the file LICENSE.GPL included in the
    ** packaging of this file.
    */
    #include <QtTest>

    class TestQString: public QObject
    {
        Q_OBJECT

    private slots:
        void toUpper_data(QtTestTable &t);
        void toUpper();
    };

    void TestQString::toUpper_data(QtTestTable &t)
    {
        t.defineElement("QString", "string");
        t.defineElement("QString", "result");

        *t.newData("all lower") << "hello" << "HELLO";
        *t.newData("mixed")     << "Hello" << "HELLO";
        *t.newData("all upper") << "HELLO" << "HELLO";
    }

    void TestQString::toUpper()
    {
        FETCH(QString, string);
        FETCH(QString, result);

        COMPARE(string.toUpper(), result);
    }

    QTTEST_MAIN(TestQString)
    #include "testqstring.moc"


Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions