aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-08-19 16:00:03 +0200
committerMitch Curtis <mitch.curtis@qt.io>2016-08-19 14:12:00 +0000
commit9b7e62a88b9d86ba6b391bf7abc18cba3c147ed5 (patch)
treeee0e87b37b314dd5357bb192613bf91bb91793a1 /tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp
parent47f32f2f768edbaa96c9356f0b2b4cb4f566b814 (diff)
Universal: ensure setting background/foreground works
- Add HasGlobalForeground and HasGlobalBackground. These are set to true when a foreground/background color is specified via settings (qtquickcontrols2.conf file or environment variables), and then used to initialize each attached style object's m_hasForeground and m_hasBackground property. - Add tst_qquickuniversalstyleconf auto test to ensure that global settings are respected. Task-number: QTBUG-55366 Change-Id: I7a8b219506f9528c4ae323bd890b418ba056ed23 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp')
-rw-r--r--tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp b/tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp
new file mode 100644
index 00000000..c676ae6d
--- /dev/null
+++ b/tests/auto/qquickuniversalstyleconf/tst_qquickuniversalstyleconf.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include "../shared/util.h"
+#include "../shared/visualtestutil.h"
+
+using namespace QQuickVisualTestUtil;
+
+class tst_qquickuniversalstyleconf : public QQmlDataTest
+{
+ Q_OBJECT
+
+public:
+
+private slots:
+ void conf();
+};
+
+void tst_qquickuniversalstyleconf::conf()
+{
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+
+ QQuickApplicationWindow *window = helper.window;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ // We specified a custom background color, so the window should have it.
+ QCOMPARE(window->property("color").value<QColor>(), QColor("#444444"));
+
+ // We specified a custom foreground color, so the label should have it.
+ QQuickItem *label = window->property("label").value<QQuickItem*>();
+ QVERIFY(label);
+ QCOMPARE(label->property("color").value<QColor>(), QColor("#E51400"));
+}
+
+QTEST_MAIN(tst_qquickuniversalstyleconf)
+
+#include "tst_qquickuniversalstyleconf.moc"