summaryrefslogtreecommitdiffstats
path: root/tests/auto/q3stylesheet
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 10:18:55 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 10:18:55 +0100
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tests/auto/q3stylesheet
Long live Qt 4.5!
Diffstat (limited to 'tests/auto/q3stylesheet')
-rw-r--r--tests/auto/q3stylesheet/.gitignore1
-rw-r--r--tests/auto/q3stylesheet/q3stylesheet.pro10
-rw-r--r--tests/auto/q3stylesheet/tst_q3stylesheet.cpp178
3 files changed, 189 insertions, 0 deletions
diff --git a/tests/auto/q3stylesheet/.gitignore b/tests/auto/q3stylesheet/.gitignore
new file mode 100644
index 0000000000..6abcddd357
--- /dev/null
+++ b/tests/auto/q3stylesheet/.gitignore
@@ -0,0 +1 @@
+tst_q3stylesheet
diff --git a/tests/auto/q3stylesheet/q3stylesheet.pro b/tests/auto/q3stylesheet/q3stylesheet.pro
new file mode 100644
index 0000000000..a5e8438f09
--- /dev/null
+++ b/tests/auto/q3stylesheet/q3stylesheet.pro
@@ -0,0 +1,10 @@
+############################################################
+# Project file for autotest for file q3stylesheet.h
+############################################################
+
+load(qttest_p4)
+QT += qt3support
+
+SOURCES += tst_q3stylesheet.cpp
+
+
diff --git a/tests/auto/q3stylesheet/tst_q3stylesheet.cpp b/tests/auto/q3stylesheet/tst_q3stylesheet.cpp
new file mode 100644
index 0000000000..8215c672f6
--- /dev/null
+++ b/tests/auto/q3stylesheet/tst_q3stylesheet.cpp
@@ -0,0 +1,178 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <qapplication.h>
+#include <qdebug.h>
+#include <q3stylesheet.h>
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+class tst_Q3StyleSheet : public QObject
+{
+Q_OBJECT
+
+public:
+ tst_Q3StyleSheet();
+ virtual ~tst_Q3StyleSheet();
+
+private slots:
+ void getSetCheck();
+};
+
+tst_Q3StyleSheet::tst_Q3StyleSheet()
+{
+}
+
+tst_Q3StyleSheet::~tst_Q3StyleSheet()
+{
+}
+
+// Testing get/set functions
+void tst_Q3StyleSheet::getSetCheck()
+{
+ Q3StyleSheet ss;
+ Q3StyleSheetItem *obj1 = new Q3StyleSheetItem(&ss, "Stylesheet Item");
+ // DisplayMode Q3StyleSheetItem::displayMode()
+ // void Q3StyleSheetItem::setDisplayMode(DisplayMode)
+ obj1->setDisplayMode(Q3StyleSheetItem::DisplayMode(Q3StyleSheetItem::DisplayInline));
+ QCOMPARE(obj1->displayMode(), Q3StyleSheetItem::DisplayMode(Q3StyleSheetItem::DisplayInline));
+ obj1->setDisplayMode(Q3StyleSheetItem::DisplayMode(Q3StyleSheetItem::DisplayListItem));
+ QCOMPARE(obj1->displayMode(), Q3StyleSheetItem::DisplayMode(Q3StyleSheetItem::DisplayListItem));
+ obj1->setDisplayMode(Q3StyleSheetItem::DisplayMode(Q3StyleSheetItem::DisplayNone));
+ QCOMPARE(obj1->displayMode(), Q3StyleSheetItem::DisplayMode(Q3StyleSheetItem::DisplayNone));
+ obj1->setDisplayMode(Q3StyleSheetItem::DisplayMode(Q3StyleSheetItem::DisplayBlock));
+ QCOMPARE(obj1->displayMode(), Q3StyleSheetItem::DisplayMode(Q3StyleSheetItem::DisplayBlock));
+
+ // int Q3StyleSheetItem::alignment()
+ // void Q3StyleSheetItem::setAlignment(int)
+ obj1->setAlignment(0);
+ QCOMPARE(obj1->alignment(), 0);
+ obj1->setAlignment(INT_MIN);
+ QCOMPARE(obj1->alignment(), INT_MIN);
+ obj1->setAlignment(INT_MAX);
+ QCOMPARE(obj1->alignment(), INT_MAX);
+
+ // VerticalAlignment Q3StyleSheetItem::verticalAlignment()
+ // void Q3StyleSheetItem::setVerticalAlignment(VerticalAlignment)
+ obj1->setVerticalAlignment(Q3StyleSheetItem::VerticalAlignment(Q3StyleSheetItem::VAlignBaseline));
+ QCOMPARE(obj1->verticalAlignment(), Q3StyleSheetItem::VerticalAlignment(Q3StyleSheetItem::VAlignBaseline));
+ obj1->setVerticalAlignment(Q3StyleSheetItem::VerticalAlignment(Q3StyleSheetItem::VAlignSub));
+ QCOMPARE(obj1->verticalAlignment(), Q3StyleSheetItem::VerticalAlignment(Q3StyleSheetItem::VAlignSub));
+ obj1->setVerticalAlignment(Q3StyleSheetItem::VerticalAlignment(Q3StyleSheetItem::VAlignSuper));
+ QCOMPARE(obj1->verticalAlignment(), Q3StyleSheetItem::VerticalAlignment(Q3StyleSheetItem::VAlignSuper));
+
+ // int Q3StyleSheetItem::fontWeight()
+ // void Q3StyleSheetItem::setFontWeight(int)
+ obj1->setFontWeight(0);
+ QCOMPARE(obj1->fontWeight(), 0);
+ obj1->setFontWeight(INT_MIN);
+ // Should return 0, but we cannot change this behavior in a Qt3Support class.
+ QCOMPARE(obj1->fontWeight(), INT_MIN); // Range<0, 99>
+ obj1->setFontWeight(INT_MAX);
+ // Should return 99, but we cannot change this behavior in a Qt3Support class.
+ QCOMPARE(obj1->fontWeight(), INT_MAX); // Range<0, 99>
+
+ // int Q3StyleSheetItem::logicalFontSize()
+ // void Q3StyleSheetItem::setLogicalFontSize(int)
+ obj1->setLogicalFontSize(0);
+ // Should return 1, but we cannot change this behavior in a Qt3Support class.
+ QCOMPARE(obj1->logicalFontSize(), 0); // Range<1, 7>
+ obj1->setLogicalFontSize(INT_MIN);
+ // Should return 1, but we cannot change this behavior in a Qt3Support class.
+ QCOMPARE(obj1->logicalFontSize(), INT_MIN); // Range<1, 7>
+ obj1->setLogicalFontSize(INT_MAX);
+ // Should return 7, but we cannot change this behavior in a Qt3Support class.
+ QCOMPARE(obj1->logicalFontSize(), INT_MAX); // Range<1, 7>
+
+ // int Q3StyleSheetItem::logicalFontSizeStep()
+ // void Q3StyleSheetItem::setLogicalFontSizeStep(int)
+ obj1->setLogicalFontSizeStep(0);
+ QCOMPARE(obj1->logicalFontSizeStep(), 0);
+ obj1->setLogicalFontSizeStep(INT_MIN);
+ QCOMPARE(obj1->logicalFontSizeStep(), INT_MIN);
+ obj1->setLogicalFontSizeStep(INT_MAX);
+ QCOMPARE(obj1->logicalFontSizeStep(), INT_MAX);
+
+ // int Q3StyleSheetItem::fontSize()
+ // void Q3StyleSheetItem::setFontSize(int)
+ obj1->setFontSize(0);
+ QCOMPARE(obj1->fontSize(), 0);
+ obj1->setFontSize(INT_MIN);
+ // Should return -1, but we cannot change this behavior in a Qt3Support class.
+ QCOMPARE(obj1->fontSize(), INT_MIN); // Expect an undefined return value for non-valid point size, as per docs
+ obj1->setFontSize(INT_MAX);
+ QCOMPARE(obj1->fontSize(), INT_MAX);
+
+ // int Q3StyleSheetItem::numberOfColumns()
+ // void Q3StyleSheetItem::setNumberOfColumns(int)
+ int currentNumCols = obj1->numberOfColumns();
+ obj1->setNumberOfColumns(0);
+ QCOMPARE(obj1->numberOfColumns(), currentNumCols); // Can't set 0 column count
+ obj1->setNumberOfColumns(INT_MIN);
+ QCOMPARE(obj1->numberOfColumns(), currentNumCols); // Can't set negative column count
+ obj1->setNumberOfColumns(INT_MAX);
+ QCOMPARE(obj1->numberOfColumns(), INT_MAX);
+
+ // WhiteSpaceMode Q3StyleSheetItem::whiteSpaceMode()
+ // void Q3StyleSheetItem::setWhiteSpaceMode(WhiteSpaceMode)
+ obj1->setWhiteSpaceMode(Q3StyleSheetItem::WhiteSpaceMode(Q3StyleSheetItem::WhiteSpaceNormal));
+ QCOMPARE(obj1->whiteSpaceMode(), Q3StyleSheetItem::WhiteSpaceMode(Q3StyleSheetItem::WhiteSpaceNormal));
+ obj1->setWhiteSpaceMode(Q3StyleSheetItem::WhiteSpaceMode(Q3StyleSheetItem::WhiteSpacePre));
+ QCOMPARE(obj1->whiteSpaceMode(), Q3StyleSheetItem::WhiteSpaceMode(Q3StyleSheetItem::WhiteSpacePre));
+ obj1->setWhiteSpaceMode(Q3StyleSheetItem::WhiteSpaceMode(Q3StyleSheetItem::WhiteSpaceNoWrap));
+ QCOMPARE(obj1->whiteSpaceMode(), Q3StyleSheetItem::WhiteSpaceMode(Q3StyleSheetItem::WhiteSpaceNoWrap));
+
+ // int Q3StyleSheetItem::lineSpacing()
+ // void Q3StyleSheetItem::setLineSpacing(int)
+ obj1->setLineSpacing(0);
+ QCOMPARE(obj1->lineSpacing(), 0);
+ obj1->setLineSpacing(INT_MIN);
+ // Should return -1, but we cannot change this behavior in a Qt3Support class.
+ QCOMPARE(obj1->lineSpacing(), INT_MIN); // Should not be able to set negative line spacing(?)
+ obj1->setLineSpacing(INT_MAX);
+ QCOMPARE(obj1->lineSpacing(), INT_MAX);
+}
+
+QTEST_MAIN(tst_Q3StyleSheet)
+#include "tst_q3stylesheet.moc"