diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-16 07:58:32 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-16 07:58:32 +0200 |
commit | 17198e03ab36e5f579a1477b09cc3e601975eb5f (patch) | |
tree | 61ba826e9edd53469abdc1e1f58b1223d0336c56 /tests/benchmarks | |
parent | a5e89005445ac8ca18ac046eaf55fe2230e47cd6 (diff) | |
parent | 2e2b32a9ab459f6618d02e4b454c75a787172def (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
qmake/doc/src/qmake-manual.qdoc
src/corelib/global/qglobal.cpp
src/corelib/tools/qstring.cpp
src/network/socket/qabstractsocket.cpp
src/network/socket/qnativesocketengine_unix.cpp
src/plugins/platforms/eglfs/api/qeglfsglobal.h
Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/gui/painting/painting.pro | 1 | ||||
-rw-r--r-- | tests/benchmarks/gui/painting/qcolor/qcolor.pro | 7 | ||||
-rw-r--r-- | tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp | 67 |
3 files changed, 75 insertions, 0 deletions
diff --git a/tests/benchmarks/gui/painting/painting.pro b/tests/benchmarks/gui/painting/painting.pro index 0eb7fa92a7..cdcfc9b318 100644 --- a/tests/benchmarks/gui/painting/painting.pro +++ b/tests/benchmarks/gui/painting/painting.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs SUBDIRS = \ + qcolor \ qpainter \ qregion \ qtransform \ diff --git a/tests/benchmarks/gui/painting/qcolor/qcolor.pro b/tests/benchmarks/gui/painting/qcolor/qcolor.pro new file mode 100644 index 0000000000..5ceb702323 --- /dev/null +++ b/tests/benchmarks/gui/painting/qcolor/qcolor.pro @@ -0,0 +1,7 @@ +QT += testlib +QT += gui-private + +TEMPLATE = app +TARGET = tst_bench_qcolor + +SOURCES += tst_qcolor.cpp diff --git a/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp b/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp new file mode 100644 index 0000000000..b67fa450d7 --- /dev/null +++ b/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QColor> + + +class tst_QColor : public QObject +{ + Q_OBJECT + +private slots: + void nameRgb(); + void nameArgb(); +}; + +void tst_QColor::nameRgb() +{ + QColor color(128, 255, 10); + QCOMPARE(color.name(), QStringLiteral("#80ff0a")); + QBENCHMARK { + color.name(); + } +} + +void tst_QColor::nameArgb() +{ + QColor color(128, 255, 0, 102); + QCOMPARE(color.name(QColor::HexArgb), QStringLiteral("#6680ff00")); + QBENCHMARK { + color.name(QColor::HexArgb); + } +} + +QTEST_MAIN(tst_QColor) + +#include "tst_qcolor.moc" |