diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-08-28 14:45:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-29 09:31:20 +0200 |
commit | 05a4df5ed72ab11a3f2cccfbec701fd63e5f9984 (patch) | |
tree | 1513f8ff854d75cb1ab9975c60a43f7f5d4d72b5 /tests/auto | |
parent | 11d944207be746cd36e49fc244d9751dd8682df9 (diff) |
Add QWinTaskbarButton auto test
Change-Id: Ib70387c54a13fa1416ec17d6246fb8e132161eec
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/auto.pro | 3 | ||||
-rw-r--r-- | tests/auto/qwintaskbarbutton/qwintaskbarbutton.pro | 4 | ||||
-rw-r--r-- | tests/auto/qwintaskbarbutton/tst_qwintaskbarbutton.cpp | 108 |
3 files changed, 114 insertions, 1 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index b50613c..f58df7e 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,4 +1,5 @@ TEMPLATE = subdirs SUBDIRS += \ qwinthumbnailtoolbar \ - qpixmap + qpixmap \ + qwintaskbarbutton diff --git a/tests/auto/qwintaskbarbutton/qwintaskbarbutton.pro b/tests/auto/qwintaskbarbutton/qwintaskbarbutton.pro new file mode 100644 index 0000000..fda7013 --- /dev/null +++ b/tests/auto/qwintaskbarbutton/qwintaskbarbutton.pro @@ -0,0 +1,4 @@ +CONFIG += testcase +TARGET = tst_qwintaskbarbutton +QT += testlib winextras +SOURCES += tst_qwintaskbarbutton.cpp diff --git a/tests/auto/qwintaskbarbutton/tst_qwintaskbarbutton.cpp b/tests/auto/qwintaskbarbutton/tst_qwintaskbarbutton.cpp new file mode 100644 index 0000000..1fd3b4b --- /dev/null +++ b/tests/auto/qwintaskbarbutton/tst_qwintaskbarbutton.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 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, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include <QWinTaskbarButton> + +class tst_QWinTaskbarButton : public QObject +{ + Q_OBJECT + +private slots: + void testWindow(); + void testOverlayIcon(); + void testOverlayIconAccessibilityDescription(); + void testProgressBar(); +}; + +void tst_QWinTaskbarButton::testWindow() +{ + QWindow window; + + QWinTaskbarButton btn1; + QVERIFY(!btn1.window()); + btn1.setWindow(&window); + QCOMPARE(btn1.window(), &window); + + QWinTaskbarButton *btn2 = new QWinTaskbarButton(&window); + QCOMPARE(btn2->window(), &window); + btn2->setWindow(0); + QVERIFY(!btn2->window()); +} + +void tst_QWinTaskbarButton::testOverlayIcon() +{ + QWinTaskbarButton btn; + QVERIFY(btn.overlayIcon().isNull()); + + QIcon icon; + QPixmap pixmap(64, 64); + pixmap.fill(Qt::transparent); + icon.addPixmap(pixmap); + + btn.setOverlayIcon(icon); + QCOMPARE(btn.overlayIcon(), icon); + + btn.clearOverlayIcon(); + QVERIFY(btn.overlayIcon().isNull()); +} + +void tst_QWinTaskbarButton::testOverlayIconAccessibilityDescription() +{ + QWinTaskbarButton btn; + QVERIFY(btn.overlayIconAccessibilityDescription().isNull()); + + btn.setOverlayIconAccessibilityDescription(QStringLiteral("Qt")); + QCOMPARE(btn.overlayIconAccessibilityDescription(), QStringLiteral("Qt")); + + btn.setOverlayIconAccessibilityDescription(QString()); + QVERIFY(btn.overlayIconAccessibilityDescription().isNull()); +} + +void tst_QWinTaskbarButton::testProgressBar() +{ + QWinTaskbarButton btn; + QVERIFY(btn.progressBar()); +} + +QTEST_MAIN(tst_QWinTaskbarButton) + +#include "tst_qwintaskbarbutton.moc" |