diff options
Diffstat (limited to 'tests')
65 files changed, 0 insertions, 3896 deletions
diff --git a/tests/.prev_CMakeLists.txt b/tests/.prev_CMakeLists.txt deleted file mode 100644 index 2214137..0000000 --- a/tests/.prev_CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Generated from tests.pro. - -if(QT_BUILD_STANDALONE_TESTS) - # Add qt_find_package calls for extra dependencies that need to be found when building - # the standalone tests here. -endif() -qt_build_tests() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index 2214137..0000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Generated from tests.pro. - -if(QT_BUILD_STANDALONE_TESTS) - # Add qt_find_package calls for extra dependencies that need to be found when building - # the standalone tests here. -endif() -qt_build_tests() diff --git a/tests/auto/.prev_CMakeLists.txt b/tests/auto/.prev_CMakeLists.txt deleted file mode 100644 index bac7e9e..0000000 --- a/tests/auto/.prev_CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Generated from auto.pro. - -add_subdirectory(cmake) -add_subdirectory(qwinthumbnailtoolbar) -add_subdirectory(qpixmap) -add_subdirectory(qwintaskbarbutton) -add_subdirectory(qwintaskbarprogress) -add_subdirectory(qwinjumplist) diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt deleted file mode 100644 index e8a3f77..0000000 --- a/tests/auto/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Generated from auto.pro. - -# add_subdirectory(cmake) # special case remove -add_subdirectory(qwinthumbnailtoolbar) -add_subdirectory(qpixmap) -add_subdirectory(qwintaskbarbutton) -add_subdirectory(qwintaskbarprogress) -add_subdirectory(qwinjumplist) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro deleted file mode 100644 index 331bf7a..0000000 --- a/tests/auto/auto.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - cmake \ - qwinthumbnailtoolbar \ - qpixmap \ - qwintaskbarbutton \ - qwintaskbarprogress \ - qwinjumplist diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt deleted file mode 100644 index 989b8f8..0000000 --- a/tests/auto/cmake/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Generated from cmake.pro. - diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro deleted file mode 100644 index 0afd8fe..0000000 --- a/tests/auto/cmake/cmake.pro +++ /dev/null @@ -1,7 +0,0 @@ - -# Cause make to do nothing. -TEMPLATE = subdirs - -CMAKE_QT_MODULES_UNDER_TEST = winextras - -CONFIG += ctest_testcase diff --git a/tests/auto/qpixmap/CMakeLists.txt b/tests/auto/qpixmap/CMakeLists.txt deleted file mode 100644 index 3fa1407..0000000 --- a/tests/auto/qpixmap/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Generated from qpixmap.pro. - -##################################################################### -## tst_qpixmap Test: -##################################################################### - -qt_add_test(tst_qpixmap - SOURCES - tst_qpixmap.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::WinExtras -) - -## Scopes: -##################################################################### - -qt_extend_target(tst_qpixmap CONDITION QT_FEATURE_dynamicgl OR (WIN32 AND NOT TARGET Qt::OpenGL) - PUBLIC_LIBRARIES - gdi32 - user32 -) diff --git a/tests/auto/qpixmap/data/icon_32bpp.ico b/tests/auto/qpixmap/data/icon_32bpp.ico Binary files differdeleted file mode 100644 index dbb55cd..0000000 --- a/tests/auto/qpixmap/data/icon_32bpp.ico +++ /dev/null diff --git a/tests/auto/qpixmap/data/icon_32bpp_16x16.png b/tests/auto/qpixmap/data/icon_32bpp_16x16.png Binary files differdeleted file mode 100644 index f23f398..0000000 --- a/tests/auto/qpixmap/data/icon_32bpp_16x16.png +++ /dev/null diff --git a/tests/auto/qpixmap/data/icon_32bpp_256x256.png b/tests/auto/qpixmap/data/icon_32bpp_256x256.png Binary files differdeleted file mode 100644 index 293f1c5..0000000 --- a/tests/auto/qpixmap/data/icon_32bpp_256x256.png +++ /dev/null diff --git a/tests/auto/qpixmap/data/icon_32bpp_32x32.png b/tests/auto/qpixmap/data/icon_32bpp_32x32.png Binary files differdeleted file mode 100644 index bfdb1fe..0000000 --- a/tests/auto/qpixmap/data/icon_32bpp_32x32.png +++ /dev/null diff --git a/tests/auto/qpixmap/data/icon_32bpp_48x48.png b/tests/auto/qpixmap/data/icon_32bpp_48x48.png Binary files differdeleted file mode 100644 index 7dd2d13..0000000 --- a/tests/auto/qpixmap/data/icon_32bpp_48x48.png +++ /dev/null diff --git a/tests/auto/qpixmap/data/icon_8bpp.ico b/tests/auto/qpixmap/data/icon_8bpp.ico Binary files differdeleted file mode 100644 index 4341a33..0000000 --- a/tests/auto/qpixmap/data/icon_8bpp.ico +++ /dev/null diff --git a/tests/auto/qpixmap/data/icon_8bpp_16x16.png b/tests/auto/qpixmap/data/icon_8bpp_16x16.png Binary files differdeleted file mode 100644 index 03b1a65..0000000 --- a/tests/auto/qpixmap/data/icon_8bpp_16x16.png +++ /dev/null diff --git a/tests/auto/qpixmap/data/icon_8bpp_32x32.png b/tests/auto/qpixmap/data/icon_8bpp_32x32.png Binary files differdeleted file mode 100644 index 0ef47c5..0000000 --- a/tests/auto/qpixmap/data/icon_8bpp_32x32.png +++ /dev/null diff --git a/tests/auto/qpixmap/data/icon_8bpp_48x48.png b/tests/auto/qpixmap/data/icon_8bpp_48x48.png Binary files differdeleted file mode 100644 index 2060854..0000000 --- a/tests/auto/qpixmap/data/icon_8bpp_48x48.png +++ /dev/null diff --git a/tests/auto/qpixmap/qpixmap.pro b/tests/auto/qpixmap/qpixmap.pro deleted file mode 100644 index 47c70fc..0000000 --- a/tests/auto/qpixmap/qpixmap.pro +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG += testcase -TARGET = tst_qpixmap -QT += gui testlib winextras -SOURCES += tst_qpixmap.cpp -win32:!qtHaveModule(opengl)|qtConfig(dynamicgl):LIBS += -lgdi32 -luser32 diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp deleted file mode 100644 index e16889d..0000000 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QtCore/qt_windows.h> -#include <QtCore/QFileInfo> -#include <QtGui/QPainter> -#include <QtGui/QPixmap> -#include <QtGui/QImage> -#include <QtWinExtras/QtWin> - -class tst_QPixmap : public QObject -{ - Q_OBJECT - -public: - tst_QPixmap() : m_dataDirectory(QFINDTESTDATA("data")) {} - -private slots: - void initTestCase(); - - void toHBITMAP_data(); - void toHBITMAP(); - void fromHBITMAP_data(); - void fromHBITMAP(); - - void toHICON_data(); - void toHICON(); - void fromHICON_data(); - void fromHICON(); - - void imageConversion(); - -private: - const QString m_dataDirectory; -}; - -void tst_QPixmap::initTestCase() -{ - QVERIFY(!m_dataDirectory.isEmpty()); -} - -void tst_QPixmap::toHBITMAP_data() -{ - QTest::addColumn<int>("red"); - QTest::addColumn<int>("green"); - QTest::addColumn<int>("blue"); - - QTest::newRow("red") << 255 << 0 << 0; - QTest::newRow("green") << 0 << 255 << 0; - QTest::newRow("blue") << 0 << 0 << 255; -} - -void tst_QPixmap::toHBITMAP() -{ - QFETCH(int, red); - QFETCH(int, green); - QFETCH(int, blue); - - QPixmap pm(100, 100); - pm.fill(QColor(red, green, blue)); - - const HBITMAP bitmap = QtWin::toHBITMAP(pm); - - QVERIFY(bitmap != nullptr); - - // Verify size - BITMAP bitmapInfo; - memset(&bitmapInfo, 0, sizeof(BITMAP)); - - QVERIFY(GetObject(bitmap, sizeof(BITMAP), &bitmapInfo)); - - QCOMPARE(LONG(100), bitmapInfo.bmWidth); - QCOMPARE(LONG(100), bitmapInfo.bmHeight); - - const HDC displayDc = GetDC(nullptr); - const HDC bitmapDc = CreateCompatibleDC(displayDc); - - const auto nullBitmap = static_cast<HBITMAP>(SelectObject(bitmapDc, bitmap)); - - const COLORREF pixel = GetPixel(bitmapDc, 0, 0); - QCOMPARE(int(GetRValue(pixel)), red); - QCOMPARE(int(GetGValue(pixel)), green); - QCOMPARE(int(GetBValue(pixel)), blue); - - // Clean up - SelectObject(bitmapDc, nullBitmap); - DeleteObject(bitmap); - DeleteDC(bitmapDc); - ReleaseDC(nullptr, displayDc); -} - -void tst_QPixmap::fromHBITMAP_data() -{ - toHBITMAP_data(); -} - -void tst_QPixmap::fromHBITMAP() -{ - QFETCH(int, red); - QFETCH(int, green); - QFETCH(int, blue); - - const HDC displayDc = GetDC(nullptr); - const HDC bitmapDc = CreateCompatibleDC(displayDc); - const HBITMAP bitmap = CreateCompatibleBitmap(displayDc, 100, 100); - SelectObject(bitmapDc, bitmap); - - SelectObject(bitmapDc, GetStockObject(NULL_PEN)); - const HGDIOBJ oldBrush = SelectObject(bitmapDc, CreateSolidBrush(RGB(red, green, blue))); - Rectangle(bitmapDc, 0, 0, 100, 100); - - const QPixmap pixmap = QtWin::fromHBITMAP(bitmap); - QCOMPARE(pixmap.width(), 100); - QCOMPARE(pixmap.height(), 100); - - const QImage image = pixmap.toImage(); - const QRgb pixel = image.pixel(0, 0); - QCOMPARE(qRed(pixel), red); - QCOMPARE(qGreen(pixel), green); - QCOMPARE(qBlue(pixel), blue); - - DeleteObject(SelectObject(bitmapDc, oldBrush)); - DeleteObject(SelectObject(bitmapDc, bitmap)); - DeleteDC(bitmapDc); - ReleaseDC(nullptr, displayDc); -} - -static bool compareImages(const QImage &actual, const QImage &expected, - QByteArray *errorMessage) -{ - if (actual.size() != expected.size()) { - QString s; - QDebug(&s) << "Size mismatch, actual: " << actual.size() << " expected: " << expected.size(); - *errorMessage = s.toLocal8Bit(); - return false; - } - if (actual.format() != expected.format()) { - *errorMessage = QByteArrayLiteral("Format mismatch, actual: ") - + QByteArray::number(actual.format()) - + QByteArrayLiteral(", expected: ") + QByteArray::number(expected.format()); - return false; - } - - static const int fuzz = 1; - - for (int y = 0; y < actual.height(); ++y) { - for (int x = 0; x < expected.width(); ++x) { - const QRgb actualRgb = actual.pixel(x, y); - const QRgb expectedRgb = expected.pixel(x, y); - const bool pixelMatches = - qAbs(qRed(actualRgb) - qRed(expectedRgb)) <= fuzz - && qAbs(qGreen(actualRgb) - qGreen(expectedRgb)) <= fuzz - && qAbs(qBlue(actualRgb) - qBlue(expectedRgb)) <= fuzz - && qAbs(qAlpha(actualRgb) - qAlpha(expectedRgb)) <= fuzz; - if (!pixelMatches) { - QString s; - QDebug(&s) << "Pixmal mismatch at " << x << ',' << y << " actual: " - << QColor(actualRgb) << " expected: " << QColor(expectedRgb); - *errorMessage = s.toLocal8Bit(); - return false; - } - } - } - return true; -} - -static inline QString pngFileName(const QString &image, int width, int height) -{ - return image + u'_' + QString::number(width) - + u'x' + QString::number(height) + QStringLiteral(".png"); -} - -void tst_QPixmap::toHICON_data() -{ - QTest::addColumn<QString>("image"); - QTest::addColumn<int>("width"); - QTest::addColumn<int>("height"); - - QTest::newRow("32bpp_16x16") << m_dataDirectory + QStringLiteral("/icon_32bpp") << 16 << 16; - QTest::newRow("32bpp_32x32") << m_dataDirectory + QStringLiteral("/icon_32bpp") << 32 << 32; - QTest::newRow("32bpp_48x48") << m_dataDirectory + QStringLiteral("/icon_32bpp") << 48 << 48; - QTest::newRow("32bpp_256x256") << m_dataDirectory + QStringLiteral("/icon_32bpp") << 256 << 256; - - QTest::newRow("8bpp_16x16") << m_dataDirectory + QStringLiteral("/icon_8bpp") << 16 << 16; - QTest::newRow("8bpp_32x32") << m_dataDirectory + QStringLiteral("/icon_8bpp") << 32 << 32; - QTest::newRow("8bpp_48x48") << m_dataDirectory + QStringLiteral("/icon_8bpp") << 48 << 48; -} - -void tst_QPixmap::toHICON() -{ - QFETCH(int, width); - QFETCH(int, height); - QFETCH(QString, image); - - QPixmap empty(width, height); - empty.fill(Qt::transparent); - - const HDC displayDc = GetDC(nullptr); - const HDC bitmapDc = CreateCompatibleDC(displayDc); - const HBITMAP bitmap = QtWin::toHBITMAP(empty, QtWin::HBitmapAlpha); - SelectObject(bitmapDc, bitmap); - - const QString imageFileName = pngFileName(image, width, height); - QVERIFY2(QFileInfo::exists(imageFileName), qPrintable(imageFileName)); - - const QImage imageFromFile = QImage(imageFileName).convertToFormat(QImage::Format_ARGB32_Premultiplied); - QVERIFY(!imageFromFile.isNull()); - - const HICON icon = QtWin::toHICON(QPixmap::fromImage(imageFromFile)); - - DrawIconEx(bitmapDc, 0, 0, icon, width, height, 0, nullptr, DI_NORMAL); - - DestroyIcon(icon); - DeleteDC(bitmapDc); - - const QImage imageFromHICON = QtWin::fromHBITMAP(bitmap, QtWin::HBitmapAlpha).toImage(); - QVERIFY(!imageFromHICON.isNull()); - - ReleaseDC(nullptr, displayDc); - - // fuzzy comparison must be used, as the pixel values change slightly during conversion - // between QImage::Format_ARGB32 and QImage::Format_ARGB32_Premultiplied, or elsewhere - QByteArray errorMessage; - QVERIFY2(compareImages(imageFromHICON, imageFromFile, &errorMessage), errorMessage.constData()); -} - -void tst_QPixmap::fromHICON_data() -{ - toHICON_data(); -} - -void tst_QPixmap::fromHICON() -{ - QFETCH(int, width); - QFETCH(int, height); - QFETCH(QString, image); - - const QString iconFileName = image + QStringLiteral(".ico"); - QVERIFY2(QFileInfo::exists(iconFileName), qPrintable(iconFileName)); - - const auto icon = - static_cast<HICON>(LoadImage(nullptr, reinterpret_cast<const wchar_t *>(iconFileName.utf16()), - IMAGE_ICON, width, height, LR_LOADFROMFILE)); - const QImage imageFromHICON = QtWin::fromHICON(icon).toImage(); - DestroyIcon(icon); - - const QString imageFileName = pngFileName(image, width, height); - QVERIFY2(QFileInfo::exists(imageFileName), qPrintable(imageFileName)); - - const QImage imageFromFile = QImage(imageFileName).convertToFormat(QImage::Format_ARGB32_Premultiplied); - QVERIFY(!imageFromFile.isNull()); - - // fuzzy comparison must be used, as the pixel values change slightly during conversion - // between QImage::Format_ARGB32 and QImage::Format_ARGB32_Premultiplied, or elsewhere - QByteArray errorMessage; - QVERIFY2(compareImages(imageFromHICON, imageFromFile, &errorMessage), errorMessage.constData()); -} - -void tst_QPixmap::imageConversion() -{ - // Extensive testing of all formats is done in QtGui; this merely tests - // the exports/linkage. - QImage image(73, 57, QImage::Format_ARGB32_Premultiplied); - image.fill(Qt::red); - QPainter painter(&image); - painter.drawLine(0, 0, image.width(), image.height()); - const HBITMAP hBitMap = QtWin::imageToHBITMAP(image); - QVERIFY(hBitMap); - const QImage fromHBitMap = QtWin::imageFromHBITMAP(hBitMap, QtWin::HBitmapPremultipliedAlpha); - QCOMPARE(fromHBitMap, image); - DeleteObject(hBitMap); -} - -QTEST_MAIN(tst_QPixmap) - -#include "tst_qpixmap.moc" diff --git a/tests/auto/qwinjumplist/CMakeLists.txt b/tests/auto/qwinjumplist/CMakeLists.txt deleted file mode 100644 index a300ee8..0000000 --- a/tests/auto/qwinjumplist/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Generated from qwinjumplist.pro. - -##################################################################### -## tst_qwinjumplist Test: -##################################################################### - -qt_add_test(tst_qwinjumplist - SOURCES - tst_qwinjumplist.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::WinExtras -) diff --git a/tests/auto/qwinjumplist/qwinjumplist.pro b/tests/auto/qwinjumplist/qwinjumplist.pro deleted file mode 100644 index 70657b4..0000000 --- a/tests/auto/qwinjumplist/qwinjumplist.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += testcase -TARGET = tst_qwinjumplist -QT += testlib winextras -SOURCES += tst_qwinjumplist.cpp diff --git a/tests/auto/qwinjumplist/tst_qwinjumplist.cpp b/tests/auto/qwinjumplist/tst_qwinjumplist.cpp deleted file mode 100644 index 4676524..0000000 --- a/tests/auto/qwinjumplist/tst_qwinjumplist.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QWinJumpList> -#include <QWinJumpListItem> -#include <QWinJumpListCategory> -#include <QOperatingSystemVersion> - -Q_DECLARE_METATYPE(QWinJumpListItem::Type) - -class tst_QWinJumpList : public QObject -{ - Q_OBJECT - -private slots: - void testRecent(); - void testFrequent(); - void testTasks(); - void testCategories(); - void testItems_data(); - void testItems(); -}; - -static inline QByteArray msgFileNameMismatch(const QString &f1, const QString &f2) -{ - const QString result = u'"' + f1 + QStringLiteral("\" != \"") - + f2 + u'"'; - return result.toLocal8Bit(); -} - -void tst_QWinJumpList::testRecent() -{ - if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8_1) - QSKIP("QTBUG-48751: Recent items do not work on Windows 8.1 or 10", Continue); - QScopedPointer<QWinJumpList> jumplist(new QWinJumpList); - QWinJumpListCategory *recent1 = jumplist->recent(); - QVERIFY(recent1); - QVERIFY(!recent1->isVisible()); - QVERIFY(recent1->title().isEmpty()); - - recent1->clear(); - QVERIFY(recent1->isEmpty()); - - recent1->addItem(nullptr); - QVERIFY(recent1->isEmpty()); - - recent1->setVisible(true); - QVERIFY(recent1->isVisible()); - recent1->addLink(QStringLiteral("tst_QWinJumpList"), QCoreApplication::applicationFilePath()); - - QTest::ignoreMessage(QtWarningMsg, "QWinJumpListCategory::addItem(): only tasks/custom categories support separators."); - recent1->addSeparator(); - - QTest::ignoreMessage(QtWarningMsg, "QWinJumpListCategory::addItem(): only tasks/custom categories support destinations."); - recent1->addDestination(QCoreApplication::applicationDirPath()); - - // cleanup the first jumplist instance and give the system a little time to update. - // then test that another jumplist instance loads up the recent item(s) added above - jumplist.reset(); - QTest::qWait(100); - - jumplist.reset(new QWinJumpList); - QWinJumpListCategory *recent2 = jumplist->recent(); - QVERIFY(recent2); - QCOMPARE(recent2->count(), 1); - - QWinJumpListItem* item = recent2->items().value(0); - QVERIFY(item); - const QString itemPath = item->filePath(); - const QString applicationFilePath = QCoreApplication::applicationFilePath(); - QVERIFY2(!itemPath.compare(applicationFilePath, Qt::CaseInsensitive), - msgFileNameMismatch(itemPath, applicationFilePath)); - QEXPECT_FAIL("", "QWinJumpListItem::title not supported for recent items", Continue); - QCOMPARE(item->title(), QStringLiteral("tst_QWinJumpList")); - - recent2->clear(); - QVERIFY(recent2->isEmpty()); -} - -void tst_QWinJumpList::testFrequent() -{ - if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8_1) - QSKIP("QTBUG-48751: Frequent items do not work on Windows 8.1 or 10", Continue); - QScopedPointer<QWinJumpList> jumplist(new QWinJumpList); - QWinJumpListCategory *frequent1 = jumplist->frequent(); - QVERIFY(frequent1); - QVERIFY(!frequent1->isVisible()); - QVERIFY(frequent1->title().isEmpty()); - - frequent1->clear(); - QVERIFY(frequent1->isEmpty()); - - frequent1->addItem(nullptr); - QVERIFY(frequent1->isEmpty()); - - frequent1->setVisible(true); - QVERIFY(frequent1->isVisible()); - frequent1->addLink(QStringLiteral("tst_QWinJumpList"), QCoreApplication::applicationFilePath()); - - QTest::ignoreMessage(QtWarningMsg, "QWinJumpListCategory::addItem(): only tasks/custom categories support separators."); - frequent1->addSeparator(); - - QTest::ignoreMessage(QtWarningMsg, "QWinJumpListCategory::addItem(): only tasks/custom categories support destinations."); - frequent1->addDestination(QCoreApplication::applicationDirPath()); - - // cleanup the first jumplist instance and give the system a little time to update. - // then test that another jumplist instance loads up the frequent item(s) added above - jumplist.reset(); - QTest::qWait(100); - - jumplist.reset(new QWinJumpList); - QWinJumpListCategory *frequent2 = jumplist->frequent(); - QVERIFY(frequent2); - QCOMPARE(frequent2->count(), 1); - - QWinJumpListItem* item = frequent2->items().value(0); - QVERIFY(item); - const QString itemPath = item->filePath(); - const QString applicationFilePath = QCoreApplication::applicationFilePath(); - QVERIFY2(!itemPath.compare(applicationFilePath, Qt::CaseInsensitive), - msgFileNameMismatch(itemPath, applicationFilePath)); - QEXPECT_FAIL("", "QWinJumpListItem::title not supported for frequent items", Continue); - QCOMPARE(item->title(), QStringLiteral("tst_QWinJumpList")); - - frequent2->clear(); - QVERIFY(frequent2->isEmpty()); -} - -void tst_QWinJumpList::testTasks() -{ - QWinJumpList jumplist; - QWinJumpListCategory *tasks = jumplist.tasks(); - QVERIFY(tasks); - QVERIFY(!tasks->isVisible()); - QVERIFY(tasks->isEmpty()); - QVERIFY(tasks->title().isEmpty()); - - tasks->setVisible(true); - QVERIFY(tasks->isVisible()); - - tasks->addItem(nullptr); - QVERIFY(tasks->isEmpty()); - - QWinJumpListItem* link1 = tasks->addLink(QStringLiteral("tst_QWinJumpList"), QCoreApplication::applicationFilePath()); - QCOMPARE(link1->type(), QWinJumpListItem::Link); - QCOMPARE(link1->title(), QStringLiteral("tst_QWinJumpList")); - QCOMPARE(link1->filePath(), QCoreApplication::applicationFilePath()); - QCOMPARE(tasks->count(), 1); - QCOMPARE(tasks->items(), QList<QWinJumpListItem *>() << link1); - - QWinJumpListItem* link2 = tasks->addLink(QStringLiteral("tst_QWinJumpList"), QCoreApplication::applicationFilePath(), QStringList(QStringLiteral("-test"))); - QCOMPARE(link2->type(), QWinJumpListItem::Link); - QCOMPARE(link2->title(), QStringLiteral("tst_QWinJumpList")); - QCOMPARE(link2->filePath(), QCoreApplication::applicationFilePath()); - QCOMPARE(link2->arguments(), QStringList(QStringLiteral("-test"))); - QCOMPARE(tasks->count(), 2); - QCOMPARE(tasks->items(), QList<QWinJumpListItem *>() << link1 << link2); - - QWinJumpListItem* separator = tasks->addSeparator(); - QCOMPARE(separator->type(), QWinJumpListItem::Separator); - QCOMPARE(tasks->count(), 3); - QCOMPARE(tasks->items(), QList<QWinJumpListItem *>() << link1 << link2 << separator); - - QWinJumpListItem* destination = tasks->addDestination(QCoreApplication::applicationDirPath()); - QCOMPARE(destination->type(), QWinJumpListItem::Destination); - QCOMPARE(destination->filePath(), QCoreApplication::applicationDirPath()); - QCOMPARE(tasks->count(), 4); - QCOMPARE(tasks->items(), QList<QWinJumpListItem *>() << link1 << link2 << separator << destination); - - tasks->clear(); - QVERIFY(tasks->isEmpty()); - QVERIFY(tasks->items().isEmpty()); -} - -void tst_QWinJumpList::testCategories() -{ - QWinJumpList jumplist; - QVERIFY(jumplist.categories().isEmpty()); - - jumplist.addCategory(nullptr); - - QWinJumpListCategory *cat1 = new QWinJumpListCategory(QStringLiteral("tmp")); - QCOMPARE(cat1->title(), QStringLiteral("tmp")); - cat1->setTitle(QStringLiteral("cat1")); - QCOMPARE(cat1->title(), QStringLiteral("cat1")); - - jumplist.addCategory(cat1); - QCOMPARE(jumplist.categories().count(), 1); - QCOMPARE(jumplist.categories().at(0), cat1); - - QWinJumpListCategory *cat2 = jumplist.addCategory(QStringLiteral("cat2")); - QCOMPARE(cat2->title(), QStringLiteral("cat2")); - - QCOMPARE(jumplist.categories().count(), 2); - QCOMPARE(jumplist.categories().at(0), cat1); - QCOMPARE(jumplist.categories().at(1), cat2); - - jumplist.clear(); - QVERIFY(jumplist.categories().isEmpty()); -} - -void tst_QWinJumpList::testItems_data() -{ - QTest::addColumn<QWinJumpListItem::Type>("type"); - - QTest::newRow("destination") << QWinJumpListItem::Destination; - QTest::newRow("separator") << QWinJumpListItem::Separator; - QTest::newRow("link") << QWinJumpListItem::Link; -} - -void tst_QWinJumpList::testItems() -{ - QFETCH(QWinJumpListItem::Type, type); - - QWinJumpListItem item(type); - QCOMPARE(item.type(), type); - QVERIFY(item.filePath().isNull()); - QVERIFY(item.workingDirectory().isNull()); - QVERIFY(item.icon().isNull()); - QVERIFY(item.title().isNull()); - QVERIFY(item.description().isNull()); - QVERIFY(item.arguments().isEmpty()); - - item.setType(QWinJumpListItem::Destination); - QCOMPARE(item.type(), QWinJumpListItem::Destination); - - item.setFilePath(QCoreApplication::applicationFilePath()); - QCOMPARE(item.filePath(), QCoreApplication::applicationFilePath()); - - item.setWorkingDirectory(QCoreApplication::applicationDirPath()); - QCOMPARE(item.workingDirectory(), QCoreApplication::applicationDirPath()); - - QIcon icon("qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png"); - item.setIcon(icon); - QCOMPARE(item.icon().cacheKey(), icon.cacheKey()); - - item.setTitle(QStringLiteral("tst_QWinJumpList")); - QCOMPARE(item.title(), QStringLiteral("tst_QWinJumpList")); - - item.setDescription(QStringLiteral("QtWinExras - tst_QWinJumpList")); - QCOMPARE(item.description(), QStringLiteral("QtWinExras - tst_QWinJumpList")); - - item.setArguments(QCoreApplication::arguments()); - QCOMPARE(item.arguments(), QCoreApplication::arguments()); -} - -QTEST_MAIN(tst_QWinJumpList) - -#include "tst_qwinjumplist.moc" diff --git a/tests/auto/qwinmime/CMakeLists.txt b/tests/auto/qwinmime/CMakeLists.txt deleted file mode 100644 index e502d1f..0000000 --- a/tests/auto/qwinmime/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Generated from qwinmime.pro. - -##################################################################### -## tst_qwinmime Test: -##################################################################### - -qt_add_test(tst_qwinmime - SOURCES - tst_qwinmime.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras -) diff --git a/tests/auto/qwintaskbarbutton/CMakeLists.txt b/tests/auto/qwintaskbarbutton/CMakeLists.txt deleted file mode 100644 index f313e0d..0000000 --- a/tests/auto/qwintaskbarbutton/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Generated from qwintaskbarbutton.pro. - -##################################################################### -## tst_qwintaskbarbutton Test: -##################################################################### - -qt_add_test(tst_qwintaskbarbutton - SOURCES - tst_qwintaskbarbutton.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::WinExtras -) diff --git a/tests/auto/qwintaskbarbutton/qwintaskbarbutton.pro b/tests/auto/qwintaskbarbutton/qwintaskbarbutton.pro deleted file mode 100644 index fda7013..0000000 --- a/tests/auto/qwintaskbarbutton/qwintaskbarbutton.pro +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index a9287a0..0000000 --- a/tests/auto/qwintaskbarbutton/tst_qwintaskbarbutton.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QWinTaskbarButton> -#include <QWinTaskbarProgress> - -class tst_QWinTaskbarButton : public QObject -{ - Q_OBJECT - -private slots: - void testWindow(); - void testOverlayIcon(); - void testOverlayAccessibleDescription(); - void testProgress(); -}; - -void tst_QWinTaskbarButton::testWindow() -{ - QWindow window; - - QWinTaskbarButton btn1; - QVERIFY(!btn1.window()); - btn1.setWindow(&window); - QCOMPARE(btn1.window(), &window); - - auto *btn2 = new QWinTaskbarButton(&window); - QCOMPARE(btn2->window(), &window); - btn2->setWindow(nullptr); - 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::testOverlayAccessibleDescription() -{ - QWinTaskbarButton btn; - QVERIFY(btn.overlayAccessibleDescription().isNull()); - - btn.setOverlayAccessibleDescription(QStringLiteral("Qt")); - QCOMPARE(btn.overlayAccessibleDescription(), QStringLiteral("Qt")); - - btn.setOverlayAccessibleDescription(QString()); - QVERIFY(btn.overlayAccessibleDescription().isNull()); -} - -void tst_QWinTaskbarButton::testProgress() -{ - QWinTaskbarButton btn; - QVERIFY(btn.progress()); - QVERIFY(btn.progress()->objectName().isEmpty()); - - btn.progress()->setObjectName(QStringLiteral("DEAD")); - delete btn.progress(); - - QVERIFY(btn.progress()); - QVERIFY(btn.progress()->objectName().isEmpty()); -} - -QTEST_MAIN(tst_QWinTaskbarButton) - -#include "tst_qwintaskbarbutton.moc" diff --git a/tests/auto/qwintaskbarprogress/CMakeLists.txt b/tests/auto/qwintaskbarprogress/CMakeLists.txt deleted file mode 100644 index e218e3e..0000000 --- a/tests/auto/qwintaskbarprogress/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Generated from qwintaskbarprogress.pro. - -##################################################################### -## tst_qwintaskbarprogress Test: -##################################################################### - -qt_add_test(tst_qwintaskbarprogress - SOURCES - tst_qwintaskbarprogress.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::WinExtras -) diff --git a/tests/auto/qwintaskbarprogress/qwintaskbarprogress.pro b/tests/auto/qwintaskbarprogress/qwintaskbarprogress.pro deleted file mode 100644 index 76b5697..0000000 --- a/tests/auto/qwintaskbarprogress/qwintaskbarprogress.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += testcase -TARGET = tst_qwintaskbarprogress -QT += testlib winextras -SOURCES += tst_qwintaskbarprogress.cpp diff --git a/tests/auto/qwintaskbarprogress/tst_qwintaskbarprogress.cpp b/tests/auto/qwintaskbarprogress/tst_qwintaskbarprogress.cpp deleted file mode 100644 index f27ba21..0000000 --- a/tests/auto/qwintaskbarprogress/tst_qwintaskbarprogress.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QWinTaskbarButton> -#include <QWinTaskbarProgress> - -class tst_QWinTaskbarProgress : public QObject -{ - Q_OBJECT - -private slots: - void testValue(); - void testRange(); - void testPause(); - void testVisibility(); - void testStop(); -}; - -void tst_QWinTaskbarProgress::testValue() -{ - QWinTaskbarButton btn; - QWinTaskbarProgress *progress = btn.progress(); - QVERIFY(progress); - QCOMPARE(progress->value(), 0); - QCOMPARE(progress->minimum(), 0); - QCOMPARE(progress->maximum(), 100); - - QSignalSpy valueSpy(progress, SIGNAL(valueChanged(int))); - QVERIFY(valueSpy.isValid()); - - progress->setValue(25); - QCOMPARE(progress->value(), 25); - QCOMPARE(valueSpy.count(), 1); - QCOMPARE(valueSpy.last().at(0).toInt(), 25); - - // under valid range -> no effect - progress->setValue(-50); - QCOMPARE(progress->value(), 25); - QCOMPARE(valueSpy.count(), 1); - - progress->setValue(75); - QCOMPARE(progress->value(), 75); - QCOMPARE(valueSpy.count(), 2); - QCOMPARE(valueSpy.last().at(0).toInt(), 75); - - // over valid range -> no effect - progress->setValue(150); - QCOMPARE(progress->value(), 75); - QCOMPARE(valueSpy.count(), 2); -} - -void tst_QWinTaskbarProgress::testRange() -{ - QWinTaskbarButton btn; - QWinTaskbarProgress *progress = btn.progress(); - QVERIFY(progress); - QCOMPARE(progress->value(), 0); - QCOMPARE(progress->minimum(), 0); - QCOMPARE(progress->maximum(), 100); - - QSignalSpy valueSpy(progress, SIGNAL(valueChanged(int))); - QSignalSpy minimumSpy(progress, SIGNAL(minimumChanged(int))); - QSignalSpy maximumSpy(progress, SIGNAL(maximumChanged(int))); - QVERIFY(valueSpy.isValid()); - QVERIFY(minimumSpy.isValid()); - QVERIFY(maximumSpy.isValid()); - - // value must remain intact - progress->setValue(50); - QCOMPARE(valueSpy.count(), 1); - - progress->setMinimum(25); - QCOMPARE(progress->minimum(), 25); - QCOMPARE(minimumSpy.count(), 1); - QCOMPARE(minimumSpy.last().at(0).toInt(), 25); - - progress->setMaximum(75); - QCOMPARE(progress->maximum(), 75); - QCOMPARE(maximumSpy.count(), 1); - QCOMPARE(maximumSpy.last().at(0).toInt(), 75); - - QCOMPARE(progress->value(), 50); - QCOMPARE(valueSpy.count(), 1); - - // value under valid range -> reset - progress->setMinimum(55); - QCOMPARE(progress->value(), 55); - QCOMPARE(progress->minimum(), 55); - QCOMPARE(valueSpy.count(), 2); - QCOMPARE(valueSpy.last().at(0).toInt(), 55); - QCOMPARE(minimumSpy.count(), 2); - QCOMPARE(minimumSpy.last().at(0).toInt(), 55); - - progress->setValue(70); - QCOMPARE(valueSpy.count(), 3); - - // value over valid range -> reset - progress->setMaximum(65); - QCOMPARE(progress->value(), 55); - QCOMPARE(progress->maximum(), 65); - QCOMPARE(valueSpy.count(), 4); - QCOMPARE(valueSpy.last().at(0).toInt(), 55); - QCOMPARE(maximumSpy.count(), 2); - QCOMPARE(maximumSpy.last().at(0).toInt(), 65); -} - -void tst_QWinTaskbarProgress::testPause() -{ - QWinTaskbarButton btn; - QWinTaskbarProgress *progress = btn.progress(); - QVERIFY(progress); - QVERIFY(!progress->isPaused()); - - QSignalSpy pausedSpy(progress, SIGNAL(pausedChanged(bool))); - QVERIFY(pausedSpy.isValid()); - - progress->setPaused(true); - QVERIFY(progress->isPaused()); - QCOMPARE(pausedSpy.count(), 1); - QCOMPARE(pausedSpy.last().at(0).toBool(), true); - - progress->setPaused(false); - QVERIFY(!progress->isPaused()); - QCOMPARE(pausedSpy.count(), 2); - QCOMPARE(pausedSpy.last().at(0).toBool(), false); - - progress->stop(); - progress->pause(); - QVERIFY(!progress->isPaused()); - QCOMPARE(pausedSpy.count(), 2); - - progress->resume(); - progress->pause(); - QVERIFY(progress->isPaused()); - QCOMPARE(pausedSpy.count(), 3); - QCOMPARE(pausedSpy.last().at(0).toBool(), true); - - progress->resume(); - QVERIFY(!progress->isPaused()); - QCOMPARE(pausedSpy.count(), 4); - QCOMPARE(pausedSpy.last().at(0).toBool(), false); -} - -void tst_QWinTaskbarProgress::testVisibility() -{ - QWinTaskbarButton btn; - QWinTaskbarProgress *progress = btn.progress(); - QVERIFY(progress); - QVERIFY(!progress->isVisible()); - - QSignalSpy visibleSpy(progress, SIGNAL(visibilityChanged(bool))); - QVERIFY(visibleSpy.isValid()); - - progress->setVisible(true); - QVERIFY(progress->isVisible()); - QCOMPARE(visibleSpy.count(), 1); - QCOMPARE(visibleSpy.last().at(0).toBool(), true); - - progress->setVisible(false); - QVERIFY(!progress->isVisible()); - QCOMPARE(visibleSpy.count(), 2); - QCOMPARE(visibleSpy.last().at(0).toBool(), false); -} - -void tst_QWinTaskbarProgress::testStop() -{ - QWinTaskbarButton btn; - QWinTaskbarProgress *progress = btn.progress(); - QVERIFY(progress); - QVERIFY(!progress->isStopped()); - - QSignalSpy stoppedSpy(progress, SIGNAL(stoppedChanged(bool))); - QVERIFY(stoppedSpy.isValid()); - - progress->pause(); - QVERIFY(progress->isPaused()); - QVERIFY(!progress->isStopped()); - progress->stop(); - QVERIFY(!progress->isPaused()); - QVERIFY(progress->isStopped()); - QCOMPARE(stoppedSpy.count(), 1); - QCOMPARE(stoppedSpy.last().at(0).toBool(), true); - - progress->resume(); - QVERIFY(!progress->isStopped()); - QCOMPARE(stoppedSpy.count(), 2); - QCOMPARE(stoppedSpy.last().at(0).toBool(), false); -} - -QTEST_MAIN(tst_QWinTaskbarProgress) - -#include "tst_qwintaskbarprogress.moc" diff --git a/tests/auto/qwinthumbnailtoolbar/CMakeLists.txt b/tests/auto/qwinthumbnailtoolbar/CMakeLists.txt deleted file mode 100644 index ec17682..0000000 --- a/tests/auto/qwinthumbnailtoolbar/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Generated from qwinthumbnailtoolbar.pro. - -##################################################################### -## tst_qwinthumbnailtoolbar Test: -##################################################################### - -qt_add_test(tst_qwinthumbnailtoolbar - SOURCES - tst_qwinthumbnailtoolbar.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::WinExtras -) diff --git a/tests/auto/qwinthumbnailtoolbar/qwinthumbnailtoolbar.pro b/tests/auto/qwinthumbnailtoolbar/qwinthumbnailtoolbar.pro deleted file mode 100644 index 7f091f5..0000000 --- a/tests/auto/qwinthumbnailtoolbar/qwinthumbnailtoolbar.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += testcase -TARGET = tst_qwinthumbnailtoolbar -QT += testlib winextras -SOURCES += tst_qwinthumbnailtoolbar.cpp diff --git a/tests/auto/qwinthumbnailtoolbar/tst_qwinthumbnailtoolbar.cpp b/tests/auto/qwinthumbnailtoolbar/tst_qwinthumbnailtoolbar.cpp deleted file mode 100644 index fc53a24..0000000 --- a/tests/auto/qwinthumbnailtoolbar/tst_qwinthumbnailtoolbar.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QWinThumbnailToolBar> -#include <QWinThumbnailToolButton> - -class tst_QWinThumbnailToolBar : public QObject -{ - Q_OBJECT - -private slots: - void testWindow(); - void testButtons(); -}; - -void tst_QWinThumbnailToolBar::testWindow() -{ - QWindow window; - - QWinThumbnailToolBar tbar1; - QVERIFY(!tbar1.window()); - tbar1.setWindow(&window); - QCOMPARE(tbar1.window(), &window); - - auto *tbar2 = new QWinThumbnailToolBar(&window); - QCOMPARE(tbar2->window(), &window); - tbar2->setWindow(nullptr); - QVERIFY(!tbar2->window()); -} - -void tst_QWinThumbnailToolBar::testButtons() -{ - QWinThumbnailToolBar tbar; - QCOMPARE(tbar.count(), 0); - QVERIFY(tbar.buttons().isEmpty()); - - tbar.addButton(nullptr); - QCOMPARE(tbar.count(), 0); - QVERIFY(tbar.buttons().isEmpty()); - - auto *btn1 = new QWinThumbnailToolButton; - auto *btn2 = new QWinThumbnailToolButton; - - tbar.addButton(btn1); - QCOMPARE(tbar.count(), 1); - QCOMPARE(tbar.buttons().count(), 1); - QCOMPARE(tbar.buttons().at(0), btn1); - - tbar.addButton(btn2); - QCOMPARE(tbar.count(), 2); - QCOMPARE(tbar.buttons().count(), 2); - QCOMPARE(tbar.buttons().at(0), btn1); - QCOMPARE(tbar.buttons().at(1), btn2); - - tbar.clear(); - QCOMPARE(tbar.count(), 0); - QVERIFY(tbar.buttons().isEmpty()); - - QList<QWinThumbnailToolButton *> buttons; - for (int i = 0; i < 3; ++i) - buttons << new QWinThumbnailToolButton; - - tbar.setButtons(buttons); - QCOMPARE(tbar.count(), buttons.count()); - QCOMPARE(tbar.buttons().count(), buttons.count()); - for (int i = 0; i < buttons.count(); ++i) - QCOMPARE(tbar.buttons().at(i), buttons.at(i)); - - tbar.removeButton(buttons.at(1)); - QCOMPARE(tbar.count(), 2); - QCOMPARE(tbar.buttons().count(), 2); - QCOMPARE(tbar.buttons().at(0), buttons.at(0)); - QCOMPARE(tbar.buttons().at(1), buttons.at(2)); - - tbar.removeButton(buttons.at(2)); - QCOMPARE(tbar.count(), 1); - QCOMPARE(tbar.buttons().count(), 1); - QCOMPARE(tbar.buttons().at(0), buttons.at(0)); - - tbar.removeButton(buttons.at(0)); - QCOMPARE(tbar.count(), 0); - QVERIFY(tbar.buttons().isEmpty()); -} - -QTEST_MAIN(tst_QWinThumbnailToolBar) - -#include "tst_qwinthumbnailtoolbar.moc" diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt deleted file mode 100644 index 7b01593..0000000 --- a/tests/manual/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Generated from manual.pro. - -if(TARGET Qt::Widgets) - add_subdirectory(dwmfeatures) - add_subdirectory(jumplist) - add_subdirectory(thumbnail) - add_subdirectory(imageconversion) -endif() diff --git a/tests/manual/dwmfeatures/.prev_CMakeLists.txt b/tests/manual/dwmfeatures/.prev_CMakeLists.txt deleted file mode 100644 index 60c8dd1..0000000 --- a/tests/manual/dwmfeatures/.prev_CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from dwmfeatures.pro. - -##################################################################### -## dwmfeatures Binary: -##################################################################### - -qt_add_executable(dwmfeatures - GUI - SOURCES - main.cpp - testwidget.cpp testwidget.h testwidget.ui - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - ENABLE_AUTOGEN_TOOLS - uic -) - -#### Keys ignored in scope 1:.:.:dwmfeatures.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/dwmfeatures/CMakeLists.txt b/tests/manual/dwmfeatures/CMakeLists.txt deleted file mode 100644 index 30a090d..0000000 --- a/tests/manual/dwmfeatures/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from dwmfeatures.pro. - -##################################################################### -## dwmfeatures Binary: -##################################################################### - -qt_add_manual_test(dwmfeatures # special case - GUI - SOURCES - main.cpp - testwidget.cpp testwidget.h testwidget.ui - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - ENABLE_AUTOGEN_TOOLS - uic -) - -#### Keys ignored in scope 1:.:.:dwmfeatures.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/dwmfeatures/dwmfeatures.pro b/tests/manual/dwmfeatures/dwmfeatures.pro deleted file mode 100644 index 2848d9c..0000000 --- a/tests/manual/dwmfeatures/dwmfeatures.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT += widgets winextras - -TARGET = dwmfeatures -TEMPLATE = app - -SOURCES += main.cpp\ - testwidget.cpp - -HEADERS += testwidget.h - -FORMS += testwidget.ui diff --git a/tests/manual/dwmfeatures/main.cpp b/tests/manual/dwmfeatures/main.cpp deleted file mode 100644 index d29a989..0000000 --- a/tests/manual/dwmfeatures/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** GNU General Public License Usage - ** Alternatively, this file may be used under the terms of the GNU - ** General Public License version 3 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** included in the packaging of this file. Please review the following - ** information to ensure the GNU General Public License requirements will - ** be met: https://www.gnu.org/licenses/gpl-3.0.html. - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include "testwidget.h" -#include <QApplication> - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - TestWidget w; - w.show(); - - return a.exec(); -} diff --git a/tests/manual/dwmfeatures/testwidget.cpp b/tests/manual/dwmfeatures/testwidget.cpp deleted file mode 100644 index e289946..0000000 --- a/tests/manual/dwmfeatures/testwidget.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** GNU General Public License Usage - ** Alternatively, this file may be used under the terms of the GNU - ** General Public License version 3 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** included in the packaging of this file. Please review the following - ** information to ensure the GNU General Public License requirements will - ** be met: https://www.gnu.org/licenses/gpl-3.0.html. - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include "testwidget.h" -#include "ui_testwidget.h" - -#include <QtWin> -#include <QWinEvent> -#include <QDebug> -#include <qt_windows.h> - -TestWidget::TestWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::TestWidget) -{ - ui->setupUi(this); - - connect(ui->btnPeekDisallow, &QAbstractButton::clicked, this, &TestWidget::onDisallowPeekClicked); - connect(ui->btnPeekExclude, &QAbstractButton::clicked, this, &TestWidget::onExcludeFromPeekClicked); - connect(ui->radioFlipDefault, &QAbstractButton::clicked, this, &TestWidget::onFlip3DPolicyChanged); - connect(ui->radioFlipAbove, &QAbstractButton::clicked, this, &TestWidget::onFlip3DPolicyChanged); - connect(ui->radioFlipBelow, &QAbstractButton::clicked, this, &TestWidget::onFlip3DPolicyChanged); - connect(ui->radioNcrpUseWindowStyle, &QAbstractButton::clicked, this, &TestWidget::onNonClientAreaRenderingPolicyChanged); - connect(ui->radioNcrpDisable, &QAbstractButton::clicked, this, &TestWidget::onNonClientAreaRenderingPolicyChanged); - connect(ui->radioNcrpEnable, &QAbstractButton::clicked, this, &TestWidget::onNonClientAreaRenderingPolicyChanged); - connect(ui->btnFrameReset, &QAbstractButton::clicked, this, &TestWidget::onResetGlassFrameClicked); - connect(ui->frameTop, QOverload<int>::of(&QSpinBox::valueChanged), - this, &TestWidget::onGlassMarginsChanged); - connect(ui->frameRight, QOverload<int>::of(&QSpinBox::valueChanged), - this, &TestWidget::onGlassMarginsChanged); - connect(ui->frameBottom, QOverload<int>::of(&QSpinBox::valueChanged), - this, &TestWidget::onGlassMarginsChanged); - connect(ui->frameLeft, QOverload<int>::of(&QSpinBox::valueChanged), - this, &TestWidget::onGlassMarginsChanged); -} - -TestWidget::~TestWidget() -{ - delete ui; -} - -void TestWidget::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - -bool TestWidget::event(QEvent *e) -{ - if (e->type() == QWinEvent::CompositionChange) { - auto *event = static_cast<QWinCompositionChangeEvent *>(e); - qDebug() << "Composition state change: " << event->isCompositionEnabled(); - } else if (e->type() == QWinEvent::ThemeChange) { - qDebug() << "Theme change."; - } - return QWidget::event(e); -} - -void TestWidget::onDisallowPeekClicked() -{ - QtWin::setWindowDisallowPeek(this, ui->btnPeekDisallow->isChecked()); -} - -void TestWidget::onExcludeFromPeekClicked() -{ - QtWin::setWindowExcludedFromPeek(this, ui->btnPeekExclude->isChecked()); -} - -void TestWidget::onFlip3DPolicyChanged() -{ - QtWin::WindowFlip3DPolicy policy; - if (ui->radioFlipAbove->isChecked()) - policy = QtWin::FlipExcludeAbove; - else if (ui->radioFlipBelow->isChecked()) - policy = QtWin::FlipExcludeBelow; - else - policy = QtWin::FlipDefault; - QtWin::setWindowFlip3DPolicy(this, policy); -} - -void TestWidget::onNonClientAreaRenderingPolicyChanged() -{ - QtWin::WindowNonClientRenderingPolicy policy; - if (ui->radioNcrpDisable->isChecked()) - policy = QtWin::NonClientRenderingDisabled; - else if (ui->radioNcrpEnable->isChecked()) - policy = QtWin::NonClientRenderingEnabled; - else - policy = QtWin::NonClientRenderingUseWindowStyle; - QtWin::setWindowNonClientAreaRenderingPolicy(this, policy); -} - -void TestWidget::onGlassMarginsChanged() -{ - if (!QtWin::isCompositionEnabled()) - return; - - // what you see here is the only way to force widget to redraw itself - // so it actually redraws itself without caching and without any glitch - // but causes flickering :( - // and yes, update() and redraw() do nothing - - if (!testAttribute(Qt::WA_NoSystemBackground)) { - - QSize original = size(); - QSize modified = original; - modified.setWidth(original.height() + 1); - resize(modified); - - setAttribute(Qt::WA_NoSystemBackground); - QtWin::extendFrameIntoClientArea(this, - ui->frameTop->value(), - ui->frameRight->value(), - ui->frameBottom->value(), - ui->frameLeft->value()); - - resize(original); - - ui->groupBox_2->setAutoFillBackground(true); - ui->groupBox_3->setAutoFillBackground(true); - ui->groupBox_4->setAutoFillBackground(true); - } else { - QtWin::extendFrameIntoClientArea(this, - ui->frameLeft->value(), - ui->frameTop->value(), - ui->frameRight->value(), - ui->frameBottom->value()); - } -} - -void TestWidget::onResetGlassFrameClicked() -{ - if (!testAttribute(Qt::WA_NoSystemBackground)) - return; - - ui->frameTop->setValue(0); - ui->frameRight->setValue(0); - ui->frameBottom->setValue(0); - ui->frameLeft->setValue(0); - - QtWin::resetExtendedFrame(this); - setAttribute(Qt::WA_NoSystemBackground, false); - - QSize original = size(); - QSize modified = original; - modified.setHeight(original.height() + 1); - resize(modified); - - ui->groupBox_2->setAutoFillBackground(false); - ui->groupBox_3->setAutoFillBackground(false); - ui->groupBox_4->setAutoFillBackground(false); - - resize(original); -} diff --git a/tests/manual/dwmfeatures/testwidget.h b/tests/manual/dwmfeatures/testwidget.h deleted file mode 100644 index 70c39c6..0000000 --- a/tests/manual/dwmfeatures/testwidget.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** GNU General Public License Usage - ** Alternatively, this file may be used under the terms of the GNU - ** General Public License version 3 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** included in the packaging of this file. Please review the following - ** information to ensure the GNU General Public License requirements will - ** be met: https://www.gnu.org/licenses/gpl-3.0.html. - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#ifndef TESTWIDGET_H -#define TESTWIDGET_H - -#include <QWidget> - -QT_BEGIN_NAMESPACE -namespace Ui { -class TestWidget; -} -QT_END_NAMESPACE - -#if defined(QT_NAMESPACE) -namespace Ui = QT_NAMESPACE::Ui; -#endif - -class TestWidget : public QWidget -{ - Q_OBJECT - -public: - explicit TestWidget(QWidget *parent = nullptr); - ~TestWidget(); - -protected: - void changeEvent(QEvent *e) override; - bool event(QEvent *) override; - -private: - Ui::TestWidget *ui; - -private slots: - void onDisallowPeekClicked(); - void onExcludeFromPeekClicked(); - void onFlip3DPolicyChanged(); - void onNonClientAreaRenderingPolicyChanged(); - void onGlassMarginsChanged(); - void onResetGlassFrameClicked(); -}; - -#endif // TESTWIDGET_H diff --git a/tests/manual/dwmfeatures/testwidget.ui b/tests/manual/dwmfeatures/testwidget.ui deleted file mode 100644 index 2ef17d8..0000000 --- a/tests/manual/dwmfeatures/testwidget.ui +++ /dev/null @@ -1,379 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>TestWidget</class> - <widget class="QWidget" name="TestWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>569</width> - <height>451</height> - </rect> - </property> - <property name="windowTitle"> - <string>QtWinExtras DWM Features</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="title"> - <string>Aero Peek</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>4</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <item> - <spacer name="horizontalSpacer_11"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnPeekDisallow"> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Disallow peek</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_12"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <spacer name="horizontalSpacer_13"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnPeekExclude"> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Exclude from peek</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_14"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Flip3D</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>4</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <item> - <widget class="QRadioButton" name="radioFlipDefault"> - <property name="text"> - <string>Default</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioFlipAbove"> - <property name="text"> - <string>Exclude above</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioFlipBelow"> - <property name="text"> - <string>Exclude below</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Non-client area rendering</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QRadioButton" name="radioNcrpUseWindowStyle"> - <property name="text"> - <string>Use window style</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioNcrpDisable"> - <property name="text"> - <string>Disable</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioNcrpEnable"> - <property name="text"> - <string>Enable</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="title"> - <string>Glass frame</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <property name="horizontalSpacing"> - <number>3</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>4</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Left</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Right</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Top</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Bottom</string> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnFrameReset"> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_6"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="frameLeft"> - <property name="minimum"> - <number>-1</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="frameRight"> - <property name="minimum"> - <number>-1</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="frameTop"> - <property name="minimum"> - <number>-1</number> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QSpinBox" name="frameBottom"> - <property name="minimum"> - <number>-1</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <layoutdefault spacing="6" margin="11"/> - <resources/> - <connections/> -</ui> diff --git a/tests/manual/imageconversion/.prev_CMakeLists.txt b/tests/manual/imageconversion/.prev_CMakeLists.txt deleted file mode 100644 index b75901a..0000000 --- a/tests/manual/imageconversion/.prev_CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Generated from imageconversion.pro. - -##################################################################### -## imageconversion Binary: -##################################################################### - -qt_add_executable(imageconversion - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - gdi32 - user32 -) - -#### Keys ignored in scope 1:.:.:imageconversion.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/imageconversion/CMakeLists.txt b/tests/manual/imageconversion/CMakeLists.txt deleted file mode 100644 index a90d080..0000000 --- a/tests/manual/imageconversion/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Generated from imageconversion.pro. - -##################################################################### -## imageconversion Binary: -##################################################################### - -qt_add_manual_test(imageconversion # special case - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - gdi32 - user32 -) - -#### Keys ignored in scope 1:.:.:imageconversion.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/imageconversion/imageconversion.pro b/tests/manual/imageconversion/imageconversion.pro deleted file mode 100644 index 3442e28..0000000 --- a/tests/manual/imageconversion/imageconversion.pro +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG += console c++11 -QT += widgets winextras -TEMPLATE = app -SOURCES += main.cpp -LIBS += -luser32 -lgdi32 diff --git a/tests/manual/imageconversion/main.cpp b/tests/manual/imageconversion/main.cpp deleted file mode 100644 index 5404348..0000000 --- a/tests/manual/imageconversion/main.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtWinExtras/QtWin> - -#include <QtGui/QAction> -#include <QtGui/QShortcut> -#include <QtWidgets/QApplication> -#include <QtWidgets/QDialogButtonBox> -#include <QtWidgets/QFileDialog> -#include <QtWidgets/QLabel> -#include <QtWidgets/QMainWindow> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> -#include <QtWidgets/QPushButton> -#include <QtWidgets/QVBoxLayout> - -#include <QtGui/QImage> -#include <QtGui/QPainter> -#include <QtGui/QPaintEvent> - -#include <QtCore/QCommandLineOption> -#include <QtCore/QCommandLineParser> -#include <QtCore/QDebug> -#include <QtCore/QTimer> -#include <QtCore/qt_windows.h> - -static void formatData(QDebug d, const void *data, qsizetype size) -{ - QDebugStateSaver saver(d); - d.noquote(); - d.nospace(); - const qsizetype minSize = 20; - d << "\nData: " << QByteArray(reinterpret_cast<const char *>(data), qMin(minSize, size)).toHex(); - if (size > minSize) - d << "..."; - d << "\n 0000000011111111222222223333333344444444"; -} - -QDebug operator<<(QDebug d, const BITMAP &b) -{ - QDebugStateSaver saver(d); - d.nospace(); - d << "BITMAP(type=" << b.bmType << ", " << b.bmWidth << 'x' << b.bmHeight - << ", widthBytes=" << b.bmWidthBytes << ", planes=" << b.bmPlanes - << ", bitsPixel=" << b.bmBitsPixel << ", bits=" << b.bmBits << ')'; - return d; -} - -QDebug operator<<(QDebug d, const BITMAPINFOHEADER &bih) -{ - QDebugStateSaver saver(d); - d.nospace(); - d << "BITMAPINFOHEADER(" << bih.biWidth << 'x' << qAbs(bih.biHeight) - << (bih.biHeight < 0 ? ", top-down" : ", bottom-up") - << ", planes=" << bih.biPlanes << ", bitCount=" << bih.biBitCount - << ", compression=" << bih.biCompression << ", size=" - << bih.biSizeImage << ')'; - return d; -} - -static void formatImage(QDebug d, const QImage &image) -{ - QDebugStateSaver s(d); - d.noquote(); - d.nospace(); - d << image; - if (const int colorTableSize = image.colorCount()) { - QList<QRgb> colorTable = image.colorTable(); - d << " Color table: " << colorTableSize << " (" << Qt::showbase << Qt::hex; // 256 by standard - int c = 0; - for ( ; c < qMin(8, colorTableSize); ++c) { - if (c) - d << ", "; - d << colorTable[c]; - } - if (c < colorTableSize) - d << "..."; - d << ')' << Qt::noshowbase << Qt::dec; - } - formatData(d, image.constBits(), image.sizeInBytes()); -} - -enum ParseOptionResult { - OptionError, - OptionUnset, - OptionSet -}; - -static ParseOptionResult parseIntOption(const QCommandLineParser &parser, const QCommandLineOption &option, - int minValue, int maxValue, int *target) -{ - if (!parser.isSet(option)) - return OptionUnset; - - const QString spec = parser.value(option); - bool ok; - const int value = spec.toInt(&ok); - if (!ok || value < minValue || value > maxValue) { - qWarning() << "Invalid value" << spec << "for" << option.names(); - return OptionError; - } - *target = value; - return OptionSet; -} - -template <typename Enum> -static ParseOptionResult parseEnumOption(const QCommandLineParser &parser, const QCommandLineOption &option, - Enum minValue, Enum maxValue, Enum *target) -{ - int intValue; - const ParseOptionResult result = parseIntOption(parser, option, int(minValue), int(maxValue), &intValue); - if (result == OptionSet) - *target = static_cast<Enum>(intValue); - return result; -} - -// Display a QImage in a dialog. -class PreviewDialog : public QDialog -{ -public: - explicit PreviewDialog(const QImage &image, QWidget *parent = nullptr); -}; - -PreviewDialog::PreviewDialog(const QImage &image, QWidget *parent) : QDialog(parent) -{ - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - QString description; - QDebug(&description) << image.size() << ", format=" << image.format(); - QLabel *descriptionLabel = new QLabel(description, this); - descriptionLabel->setWordWrap(true); - auto *layout = new QVBoxLayout(this); - layout->addWidget(descriptionLabel); - auto *hLayout = new QHBoxLayout; - QLabel *label = new QLabel(this); - label->setFrameShape(QFrame::Box); - label->setPixmap(QPixmap::fromImage(image)); - hLayout->addStretch(); - hLayout->addWidget(label); - hLayout->addStretch(); - layout->addLayout(hLayout); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); - connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - layout->addWidget(buttonBox); -} - -// Widget that paints a HBITMAP using GDI API in WM_PAINT. -class PaintWidget : public QWidget -{ - Q_OBJECT -public: - explicit PaintWidget(HBITMAP hBitmap, QWidget *p = nullptr) : QWidget(p), m_hBitmap(hBitmap) { } - -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override; -#else - bool nativeEvent(const QByteArray &eventType, void *message, long *result) override; -#endif - -public slots: - void saveBitmap(); - void convertBack(); - -protected: - void contextMenuEvent(QContextMenuEvent *) override; - -private: - const HBITMAP m_hBitmap; -}; - -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -bool PaintWidget::nativeEvent(const QByteArray &eventType, void *messageIn, qintptr *result) -#else -bool PaintWidget::nativeEvent(const QByteArray &eventType, void *messageIn, long *result) -#endif -{ - MSG *message = reinterpret_cast<MSG *>(messageIn); - if (message->message != WM_PAINT) - return QWidget::nativeEvent(eventType, message, result); - - PAINTSTRUCT paintStruct; - BITMAP bitmap; - - const HDC hdc = BeginPaint(message->hwnd, &paintStruct); - SelectObject(hdc, GetStockObject(BLACK_PEN)); - Rectangle(hdc, 1, 1, width() - 1, height() - 1); - - const HDC hdcMem = CreateCompatibleDC(hdc); - const HGDIOBJ oldBitmap = SelectObject(hdcMem, m_hBitmap); - - GetObject(m_hBitmap, sizeof(bitmap), &bitmap); - { - QDebug d = qDebug(); - d << __FUNCTION__ << bitmap; - formatData(d, bitmap.bmBits, bitmap.bmHeight * bitmap.bmWidthBytes); - } - BitBlt(hdc, 5, 5, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY); - SelectObject(hdcMem, oldBitmap); - DeleteDC(hdcMem); - - EndPaint(message->hwnd, &paintStruct); - return true; -} - -void PaintWidget::convertBack() -{ - QImage image = QtWin::imageFromHBITMAP(m_hBitmap); - formatImage(qDebug(), image); - auto *dialog = new PreviewDialog(image, this); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->setModal(false); - dialog->setWindowTitle(QLatin1String("QImage - Qt ") + QLatin1String(QT_VERSION_STR)); - dialog->show(); -} - -void PaintWidget::saveBitmap() -{ - QImage image = QtWin::imageFromHBITMAP(m_hBitmap); - formatImage(qDebug(), image); - QFileDialog fileDialog(this); - fileDialog.setAcceptMode(QFileDialog::AcceptSave); - fileDialog.setMimeTypeFilters(QStringList(QStringLiteral("image/png"))); - fileDialog.setDefaultSuffix(QStringLiteral("png")); - fileDialog.selectFile(QStringLiteral("test.png")); - while (fileDialog.exec() == QDialog::Accepted) { - const QString fileName = fileDialog.selectedFiles().first(); - if (image.save(fileName)) { - qDebug().noquote() << "saved" << QDir::toNativeSeparators(fileName); - break; - } - qWarning().noquote() << "Could not save" << QDir::toNativeSeparators(fileName); - } -} - -void PaintWidget::contextMenuEvent(QContextMenuEvent *e) -{ - QMenu contextMenu; - contextMenu.addAction(QStringLiteral("Convert into QImage"), this, &PaintWidget::convertBack); - QAction *saveAction = contextMenu.addAction(QStringLiteral("Save"), this, &PaintWidget::saveBitmap); - saveAction->setShortcut(Qt::CTRL + Qt::Key_S); - contextMenu.exec(e->globalPos()); -} - -static const char description[] = -"\nCreates a HBITMAP from a QImage either passed as file name or by drawing in a\n" -"format determined by a command line option and draws it onto a native window\n" -"for comparison. Provides a context menu for converting the HBITMAP back to a\n" -"QImage and saving that for checking the reverse conversion."; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QCoreApplication::setApplicationName("imageconversion"); - QCoreApplication::setOrganizationName("QtProject"); - QCoreApplication::setApplicationVersion(QT_VERSION_STR); - QCommandLineParser parser; - parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); - parser.setApplicationDescription("Qt Windows Extras Image Conversion Tester"); - parser.addHelpOption(); - parser.addVersionOption(); - parser.setApplicationDescription(description); - - const QCommandLineOption formatOption(QStringList{"format", "f"}, - "QImage format", "format"); - parser.addOption(formatOption); - const QCommandLineOption colorOption(QStringList{"color", "c"}, - "Fill color", "color-spec"); - parser.addOption(colorOption); - const QCommandLineOption globalColorOption(QStringList{"globalColor", "g"}, - "Fill color (global color enum value)", "global-color"); - parser.addOption(globalColorOption); - const QCommandLineOption widthOption(QStringList{"width", "w"}, - "Width", "width"); - parser.addOption(widthOption); - const QCommandLineOption heightOption(QStringList{"height", "h"}, - "Height", "height"); - parser.addOption(heightOption); - const QCommandLineOption previewOption(QStringList{"preview", "p"}, - "Show a preview"); - parser.addOption(previewOption); - - parser.addPositionalArgument("file", "The image file to open."); - parser.process(app); - - QColor defaultColor(Qt::red); - if (parser.isSet(colorOption)) { - const QString spec = parser.value(colorOption); - defaultColor = QColor(spec); - if (!defaultColor.isValid()) { - qWarning() << "Invalid color specification" << spec; - return -1; - } - } else { - // Color 0: color0, 1: color1, 2: black, 3: white, 7:red, 9: blue, 8: green - Qt::GlobalColor globalColor = Qt::color0; - if (!parseEnumOption(parser, globalColorOption, Qt::black, Qt::transparent, &globalColor)) - return -1; - if (globalColor != Qt::color0) - defaultColor = QColor(defaultColor); - } - - // Format: 1: mono, 3: Indexed8, 7: RGB 16, 11: RGB555, 13: RGB888 - QImage::Format targetFormat = QImage::Format_ARGB32_Premultiplied; - if (!parseEnumOption(parser, formatOption, QImage::Format_Mono, QImage::Format_Grayscale8, &targetFormat)) - return -1; - // Can't paint on indexed nor mono, need transform? - const QImage::Format drawFormat = targetFormat == QImage::Format_Indexed8 - || targetFormat == QImage::Format_Mono || targetFormat == QImage::Format_MonoLSB - ? QImage::Format_ARGB32_Premultiplied : targetFormat; - - if (targetFormat == QImage::Format_Mono || targetFormat == QImage::Format_MonoLSB) - defaultColor = Qt::white; - - int width = 73; - int height = 57; - if (!parseIntOption(parser, widthOption, 1, 2000, &width) || !parseIntOption(parser, heightOption, 1, 2000, &height)) - return -1; - - const bool preview = parser.isSet(previewOption); - - QImage image; - if (!parser.positionalArguments().isEmpty()) { - QString fileName = parser.positionalArguments().constFirst(); - image = QImage(fileName); - if (image.isNull() || image.size().isEmpty()) { - qWarning().noquote() << "Image load fail" << QDir::toNativeSeparators(fileName); - return -1; - } - } - - if (image.isNull()) { - qDebug() << "Default image color=" << defaultColor - << Qt::showbase << Qt::hex << defaultColor.rgba() << Qt::noshowbase << Qt::dec - << ", format=" << drawFormat; - image = QImage(width, height, drawFormat); - image.fill(defaultColor); - QPainter painter(&image); - painter.drawLine(0, 0, image.width(), image.height()); - } - - if (image.format() != targetFormat) { - qDebug() << "Converting " << image.format() << targetFormat; - image = image.convertToFormat(targetFormat); - } - - formatImage(qDebug(), image); - - const HBITMAP bitmap = QtWin::imageToHBITMAP(image); - if (!bitmap) { - qWarning() << "Failed to create HBITMAP"; - return -1; - } - - int exitCode = 0; - { - PaintWidget paintWidget(bitmap); - auto *quitShortcut = new QShortcut(&paintWidget); - quitShortcut->setKey(Qt::CTRL + Qt::Key_Q); - quitShortcut->setContext(Qt::ApplicationShortcut); - QObject::connect(quitShortcut, &QShortcut::activated, qApp, &QCoreApplication::quit); - paintWidget.setWindowTitle(QLatin1String("HBITMAP - Qt ") + QLatin1String(QT_VERSION_STR)); - paintWidget.show(); - if (preview) { - auto *dialog = new PreviewDialog(image); - dialog->setModal(false); - dialog->setWindowTitle(QLatin1String("QImage - Qt ") + QLatin1String(QT_VERSION_STR)); - dialog->move(paintWidget.frameGeometry().topRight() + QPoint(50, 0)); - dialog->show(); - } - exitCode = app.exec(); - } - - DeleteObject(bitmap); - - return exitCode; -} - -#include "main.moc" diff --git a/tests/manual/jumplist/.prev_CMakeLists.txt b/tests/manual/jumplist/.prev_CMakeLists.txt deleted file mode 100644 index b73180a..0000000 --- a/tests/manual/jumplist/.prev_CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from jumplist.pro. - -##################################################################### -## jumplist Binary: -##################################################################### - -qt_add_executable(jumplist - GUI - SOURCES - main.cpp - testwidget.cpp testwidget.h testwidget.ui - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - ENABLE_AUTOGEN_TOOLS - uic -) - -#### Keys ignored in scope 1:.:.:jumplist.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/jumplist/CMakeLists.txt b/tests/manual/jumplist/CMakeLists.txt deleted file mode 100644 index 916c125..0000000 --- a/tests/manual/jumplist/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Generated from jumplist.pro. - -##################################################################### -## jumplist Binary: -##################################################################### - -qt_add_manual_test(jumplist # special case - GUI - SOURCES - main.cpp - testwidget.cpp testwidget.h testwidget.ui - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras - ENABLE_AUTOGEN_TOOLS - uic -) - -#### Keys ignored in scope 1:.:.:jumplist.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/jumplist/jumplist.pro b/tests/manual/jumplist/jumplist.pro deleted file mode 100644 index c8a061d..0000000 --- a/tests/manual/jumplist/jumplist.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT += widgets winextras - -TARGET = jumplist -TEMPLATE = app - -SOURCES += main.cpp\ - testwidget.cpp - -HEADERS += testwidget.h - -FORMS += testwidget.ui diff --git a/tests/manual/jumplist/main.cpp b/tests/manual/jumplist/main.cpp deleted file mode 100644 index 464b915..0000000 --- a/tests/manual/jumplist/main.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** GNU General Public License Usage - ** Alternatively, this file may be used under the terms of the GNU - ** General Public License version 3 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** included in the packaging of this file. Please review the following - ** information to ensure the GNU General Public License requirements will - ** be met: https://www.gnu.org/licenses/gpl-3.0.html. - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include "testwidget.h" - -#include <QApplication> -#include <QCommandLineParser> -#include <QCommandLineOption> -#include <QDir> -#include <QDebug> -#include <QMimeDatabase> -#include <QSettings> -#include <QStatusBar> - -#include <algorithm> -#include <iterator> - -static bool associateFileType() -{ - const QString applicationBinary = QCoreApplication::applicationFilePath(); - QString exeFileName = applicationBinary; - const int lastSlashPos = exeFileName.lastIndexOf(u'/'); - exeFileName.remove(0, lastSlashPos + 1); - QSettings regApplications("HKEY_CURRENT_USER\\Software\\Classes\\Applications\\" + exeFileName, QSettings::NativeFormat); - regApplications.setValue("FriendlyAppName", QGuiApplication::applicationDisplayName()); - - regApplications.beginGroup("SupportedTypes"); - QMimeDatabase mimeDatabase; - const auto types = TestWidget::supportedMimeTypes(); - for (const QString &t : types) { - const auto suffixes = mimeDatabase.mimeTypeForName(t).suffixes(); - for (const QString &s : suffixes) - regApplications.setValue('.' + s, QString()); - } - regApplications.endGroup(); - - regApplications.beginGroup("shell"); - regApplications.beginGroup("open"); - regApplications.setValue("FriendlyAppName", QGuiApplication::applicationDisplayName()); - regApplications.beginGroup("command"); - regApplications.setValue(".", '"' + QDir::toNativeSeparators(applicationBinary) + "\" \"%1\""); - regApplications.endGroup(); - regApplications.endGroup(); - regApplications.endGroup(); - return regApplications.status() == QSettings::NoError; -} - -int main(int argc, char *argv[]) -{ - QStringList allArgs; // Show all arguments including style. - std::copy(argv + 1, argv + argc, std::back_inserter(allArgs)); - - QApplication app(argc, argv); - QGuiApplication::setApplicationDisplayName(QStringLiteral("QtWinExtras JumpList Test")); - if (!associateFileType()) { - qWarning() << "Unable to create registry entries."; - return -1; - } - - QCoreApplication::setOrganizationName("QtProject"); - QCoreApplication::setApplicationVersion(QT_VERSION_STR); - QCommandLineParser parser; - parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); - parser.setApplicationDescription(QGuiApplication::applicationDisplayName()); - parser.addHelpOption(); - parser.addVersionOption(); - QCommandLineOption textOption("text", "Show some text"); - parser.addOption(textOption); - QCommandLineOption fullScreenOption("fullscreen", "Show fullscreen"); - parser.addOption(fullScreenOption); - QCommandLineOption idOption("id", "Jump list identifier", "id"); - parser.addOption(idOption); - parser.addPositionalArgument("file", "The file to open."); - parser.process(app); - - TestWidget w; - - if (parser.isSet(idOption)) - w.setId(parser.value(idOption)); - - if (parser.isSet(fullScreenOption)) - w.showFullScreen(); - else - w.show(); - - if (parser.isSet(textOption)) - w.setText("Hello, world!"); - - if (!parser.positionalArguments().isEmpty()) - w.showFile(parser.positionalArguments().first()); - - if (allArgs.isEmpty()) - w.statusBar()->showMessage("Remember to run windeployqt"); - else - w.statusBar()->showMessage("Arguments: " + allArgs.join(' ')); - - return app.exec(); -} diff --git a/tests/manual/jumplist/testwidget.cpp b/tests/manual/jumplist/testwidget.cpp deleted file mode 100644 index 01a1275..0000000 --- a/tests/manual/jumplist/testwidget.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** GNU General Public License Usage - ** Alternatively, this file may be used under the terms of the GNU - ** General Public License version 3 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** included in the packaging of this file. Please review the following - ** information to ensure the GNU General Public License requirements will - ** be met: https://www.gnu.org/licenses/gpl-3.0.html. - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include "testwidget.h" -#include "ui_testwidget.h" - -#include <QApplication> -#include <QStyle> -#include <QFile> -#include <QFileDialog> -#include <QDesktopServices> -#include <QMessageBox> -#include <QProcess> -#include <QStatusBar> -#include <QUrl> -#include <QWinJumpList> -#include <QWinJumpListItem> -#include <QWinJumpListCategory> -#include <QDebug> - -TestWidget::TestWidget(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::TestWidget) -{ - ui->setupUi(this); - - connect(ui->actionUpdate, &QAction::triggered, this, &TestWidget::updateJumpList); - connect(ui->actionOpen, &QAction::triggered, this, &TestWidget::openFile); - connect(ui->actionExit, &QAction::triggered, QCoreApplication::quit); - connect(ui->actionShow_in_Explorer, &QAction::triggered, this, &TestWidget::showInExplorer); - connect(ui->actionRun_JumpListView, &QAction::triggered, this, &TestWidget::runJumpListView); -} - -TestWidget::~TestWidget() -{ - delete ui; -} - -QStringList TestWidget::supportedMimeTypes() -{ - return QStringList() << "text/x-c++src" << "text/x-csrc" << "text/x-chdr" - << "text/x-c++hdr" << "text/x-qml" << "text/plain"; -} - -void TestWidget::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - -void TestWidget::showFile(const QString &path) -{ - QFile file(path); - if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) { - const QString error = "Failed to open file " + QDir::toNativeSeparators(path) - + ": " + file.errorString(); - QMessageBox::warning(this, "Error", error); - return; - } - setText(QString::fromUtf8(file.readAll())); -} - -void TestWidget::setText(const QString &text) -{ - ui->text->setPlainText(text); -} - -void TestWidget::updateJumpList() -{ - QWinJumpList jumplist; - if (!m_id.isEmpty()) - jumplist.setIdentifier(m_id); - const QString applicationBinary = QDir::toNativeSeparators(QCoreApplication::applicationFilePath()); - jumplist.recent()->setVisible(ui->cbShowRecent->isChecked()); - jumplist.frequent()->setVisible(ui->cbShowFrequent->isChecked()); - if (ui->cbRunFullscreen->isChecked()) { - auto *item = new QWinJumpListItem(QWinJumpListItem::Link); - item->setTitle(ui->cbRunFullscreen->text()); - item->setFilePath(applicationBinary); - item->setArguments(QStringList("-fullscreen")); - item->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton)); - jumplist.tasks()->addItem(item); - } - if (ui->cbRunFusion->isChecked()) { - jumplist.tasks()->addLink(style()->standardIcon(QStyle::SP_DesktopIcon), - ui->cbRunFusion->text(), - applicationBinary, - (QStringList() << "-style" << "fusion")); - } - if (ui->cbRunText->isChecked()) { - jumplist.tasks()->addSeparator(); - jumplist.tasks()->addLink(ui->cbRunText->text(), - applicationBinary, - QStringList("-text")); - } - jumplist.tasks()->setVisible(!jumplist.tasks()->isEmpty()); -} - -void TestWidget::openFile() -{ - QFileDialog fileDialog(this, "Open a Text File"); - fileDialog.setAcceptMode(QFileDialog::AcceptOpen); - fileDialog.setMimeTypeFilters(TestWidget::supportedMimeTypes()); - // Note: The native file dialog creates the frequent/recent entries. - if (!ui->actionUse_Native_File_Dialog->isChecked()) - fileDialog.setOption(QFileDialog::DontUseNativeDialog); - if (fileDialog.exec() == QDialog::Accepted) - showFile(fileDialog.selectedFiles().first()); -} - -void TestWidget::showInExplorer() -{ - const QString path = QFile::decodeName(qgetenv("APPDATA")) - + "/Microsoft/Windows/Recent/Automaticdestinations"; - QDesktopServices::openUrl(QUrl::fromLocalFile(path)); -} - -void TestWidget::runJumpListView() -{ - const char binary[] = "JumpListsView"; - if (!QProcess::startDetached(binary, QStringList())) - statusBar()->showMessage(QLatin1String("Unable to run ") + binary); -} diff --git a/tests/manual/jumplist/testwidget.h b/tests/manual/jumplist/testwidget.h deleted file mode 100644 index 0cae1ea..0000000 --- a/tests/manual/jumplist/testwidget.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** GNU General Public License Usage - ** Alternatively, this file may be used under the terms of the GNU - ** General Public License version 3 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** included in the packaging of this file. Please review the following - ** information to ensure the GNU General Public License requirements will - ** be met: https://www.gnu.org/licenses/gpl-3.0.html. - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#ifndef TESTWIDGET_H -#define TESTWIDGET_H - -#include <QMainWindow> - -QT_BEGIN_NAMESPACE -namespace Ui { -class TestWidget; -} -QT_END_NAMESPACE - -#if defined(QT_NAMESPACE) -namespace Ui = QT_NAMESPACE::Ui; -#endif - -class TestWidget : public QMainWindow -{ - Q_OBJECT - -public: - explicit TestWidget(QWidget *parent = nullptr); - ~TestWidget(); - - void showFile(const QString &path); - void setText(const QString &text); - - static QStringList supportedMimeTypes(); - - QString id() const { return m_id; } - void setId(const QString &id) { m_id = id; } - -protected: - void changeEvent(QEvent *e) Q_DECL_OVERRIDE; - -private slots: - void updateJumpList(); - void showInExplorer(); - void runJumpListView(); - void openFile(); - -private: - Ui::TestWidget *ui; - QString m_id; -}; - -#endif // TESTWIDGET_H diff --git a/tests/manual/jumplist/testwidget.ui b/tests/manual/jumplist/testwidget.ui deleted file mode 100644 index abcb078..0000000 --- a/tests/manual/jumplist/testwidget.ui +++ /dev/null @@ -1,237 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>TestWidget</class> - <widget class="QMainWindow" name="TestWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>800</width> - <height>600</height> - </rect> - </property> - <widget class="QWidget" name="centralwidget"> - <property name="windowTitle"> - <string>QtWinExtras JumpList</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Known categories</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QCheckBox" name="cbShowFrequent"> - <property name="text"> - <string>Frequent</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cbShowRecent"> - <property name="text"> - <string>Recent</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Tasks</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QCheckBox" name="cbRunFullscreen"> - <property name="text"> - <string>Run in fullscreen</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cbRunFusion"> - <property name="text"> - <string>Run with Fusion style</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cbRunText"> - <property name="text"> - <string>Run with some text displayed</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QTextEdit" name="text"> - <property name="font"> - <font> - <family>Consolas</family> - <pointsize>10</pointsize> - </font> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menuBar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>800</width> - <height>21</height> - </rect> - </property> - <widget class="QMenu" name="menuFile"> - <property name="title"> - <string>File</string> - </property> - <addaction name="actionOpen"/> - <addaction name="actionExit"/> - </widget> - <widget class="QMenu" name="menuJumplist"> - <property name="title"> - <string>Jumplist</string> - </property> - <addaction name="actionUpdate"/> - <addaction name="actionShow_in_Explorer"/> - <addaction name="actionRun_JumpListView"/> - </widget> - <widget class="QMenu" name="menuSettings"> - <property name="title"> - <string>Settings</string> - </property> - <addaction name="actionUse_Native_File_Dialog"/> - </widget> - <addaction name="menuFile"/> - <addaction name="menuJumplist"/> - <addaction name="menuSettings"/> - </widget> - <action name="actionOpen"> - <property name="text"> - <string>Open</string> - </property> - <property name="shortcut"> - <string>Ctrl+O</string> - </property> - </action> - <action name="actionExit"> - <property name="text"> - <string>Exit</string> - </property> - <property name="shortcut"> - <string>Ctrl+Q</string> - </property> - </action> - <action name="actionUpdate"> - <property name="text"> - <string>Update</string> - </property> - <property name="shortcut"> - <string>Ctrl+U</string> - </property> - </action> - <action name="actionShow_in_Explorer"> - <property name="text"> - <string>Show in Explorer</string> - </property> - <property name="shortcut"> - <string>Ctrl+E</string> - </property> - </action> - <action name="actionRun_JumpListView"> - <property name="text"> - <string>Run JumpListView</string> - </property> - <property name="toolTip"> - <string>Run JumpListView utility</string> - </property> - </action> - <action name="actionUse_Native_File_Dialog"> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="text"> - <string>Use Native File Dialog</string> - </property> - </action> - </widget> - <layoutdefault spacing="6" margin="11"/> - <resources/> - <connections/> -</ui> diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro deleted file mode 100644 index be1698c..0000000 --- a/tests/manual/manual.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = subdirs -qtHaveModule(widgets) { - SUBDIRS += \ - dwmfeatures \ - jumplist \ - thumbnail \ - imageconversion -} diff --git a/tests/manual/quickdwmfeatures/main.qml b/tests/manual/quickdwmfeatures/main.qml deleted file mode 100644 index 3448a1f..0000000 --- a/tests/manual/quickdwmfeatures/main.qml +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 Ivan Vizir <define-true-false@yandex.com> - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the QtWinExtras module of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** GNU General Public License Usage - ** Alternatively, this file may be used under the terms of the GNU - ** General Public License version 3 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** included in the packaging of this file. Please review the following - ** information to ensure the GNU General Public License requirements will - ** be met: https://www.gnu.org/licenses/gpl-3.0.html. - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Window 2.0 -import QtQuick.Layouts 1.0 -import QtWinExtras 1.0 -import QtGraphicalEffects 1.0 - -Window { - title: "DWM Features QtWinExtras manual test" - width: 350 - height: 261 - - DwmFeatures { - id: dwm - leftGlassMargin: sboxLeft.value - rightGlassMargin: sboxRight.value - topGlassMargin: sboxTop.value - bottomGlassMargin: sboxBottom.value - blurBehindEnabled: cbBlurBehind.checked - - excludedFromPeek: cbExcludedFromPeek.checked - peekDisallowed: cbPeekDisallowed.checked - - Component.onCompleted: { - cbCompositionEnabled.checked = compositionEnabled - compositionEnabled = Qt.binding(function () { return cbCompositionEnabled.checked }) - } - } - - Rectangle { - anchors.fill: parent - anchors.leftMargin: dwm.compositionEnabled ? dwm.leftGlassMargin : 0 - anchors.rightMargin: dwm.compositionEnabled ? dwm.rightGlassMargin : 0 - anchors.topMargin: dwm.compositionEnabled ? dwm.topGlassMargin : 0 - anchors.bottomMargin: dwm.compositionEnabled ? dwm.bottomGlassMargin : 0 - - visible: !dwm.compositionEnabled || dwm.topGlassMargin > -1 && dwm.leftGlassMargin > -1 && dwm.rightGlassMargin > -1 && dwm.bottomGlassMargin > -1 && !cbBlurBehind.checked - } - - GridLayout { - anchors.fill: parent - anchors.margins: 2 - columns: 2 - - CheckBox { - id: cbCompositionEnabled - text: "Composition enabled" - Layout.columnSpan: 2 - } - - CheckBox { - id: cbBlurBehind - text: "Blur behind enabled" - Layout.columnSpan: 2 - enabled: cbCompositionEnabled.checked - } - - Label { text: "Top glass frame margin" } - SpinBox { id: sboxTop; minimumValue: -1; maximumValue: 40; value: 0; Layout.alignment: Qt.AlignRight; enabled: cbCompositionEnabled.checked } - Label { text: "Right glass frame margin" } - SpinBox { id: sboxRight; minimumValue: -1; maximumValue: 40; value: 0; Layout.alignment: Qt.AlignRight; enabled: cbCompositionEnabled.checked } - Label { text: "Bottom glass frame margin" } - SpinBox { id: sboxBottom; minimumValue: -1; maximumValue: 40; value: 0; Layout.alignment: Qt.AlignRight; enabled: cbCompositionEnabled.checked } - Label { text: "Left glass frame margin" } - SpinBox { id: sboxLeft; minimumValue: -1; maximumValue: 40; value: 0; Layout.alignment: Qt.AlignRight; enabled: cbCompositionEnabled.checked } - - CheckBox { - id: cbExcludedFromPeek - text: "Excluded from peek" - Layout.columnSpan: 2 - enabled: cbCompositionEnabled.checked - } - - CheckBox { - id: cbPeekDisallowed - text: "Peek disallowed" - Layout.columnSpan: 2 - enabled: cbCompositionEnabled.checked - } - - Rectangle { - id: rcColorization - width: parent.width - height: 32 - color: dwm.realColorizationColor - Layout.fillWidth: true - Layout.columnSpan: 2 - border.width: 4 - border.color: ''+dwm.realColorizationColor - - Label { text: "Real colorization color"; anchors.centerIn: parent} - } - - Rectangle { - width: parent.width - height: 32 - color: dwm.colorizationColor - Layout.fillWidth: true - Layout.columnSpan: 2 - border.width: 4 - border.color: ''+dwm.colorizationColor - - Label { text: "API-given colorization color (blended)"; anchors.centerIn: parent} - } - - Item { Layout.fillHeight: true } - } -} diff --git a/tests/manual/quickdwmfeatures/quickdwmfeatures.qmlproject b/tests/manual/quickdwmfeatures/quickdwmfeatures.qmlproject deleted file mode 100644 index e5a8bf0..0000000 --- a/tests/manual/quickdwmfeatures/quickdwmfeatures.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/tests/manual/quickjumplist/main.qml b/tests/manual/quickjumplist/main.qml deleted file mode 100644 index ba32654..0000000 --- a/tests/manual/quickjumplist/main.qml +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.1 -import QtWinExtras 1.0 -import QtQuick.Dialogs 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 - -ApplicationWindow { - id: window - - title: "JumpList" - - width: 800 - height: 400 - minimumWidth: groupBox.implicitWidth + 40 - minimumHeight: groupBox.implicitHeight + 40 - - JumpList { - id: jumpList - recent.visible: recentBox.checked - frequent.visible: frequentBox.checked - tasks: JumpListCategory { - visible: tasksBox.checked - JumpListLink { - title: "qmlscene" - description: "qmlscene main.qml" - executablePath: Qt.application.arguments[0] - arguments: Qt.application.arguments[1] - } - } - JumpListCategory { - title: "Custom" - visible: customBox.checked - JumpListLink { - title: "qmlscene" - description: "qmlscene main.qml" - executablePath: Qt.application.arguments[0] - arguments: Qt.application.arguments[1] - } - } - } - - GroupBox { - id: groupBox - title: "JumpList" - anchors.centerIn: parent - RowLayout { - anchors.fill: parent - anchors.margins: 20 - ColumnLayout { - CheckBox { - id: recentBox - text: "Recent" - } - CheckBox { - id: frequentBox - text: "Frequent" - } - CheckBox { - id: tasksBox - text: "Tasks" - } - CheckBox { - id: customBox - text: "Custom" - } - } - Button { - text: "Open..." - onClicked: dialog.open() - FileDialog { - id: dialog - } - } - } - } -} diff --git a/tests/manual/quickjumplist/quickjumplist.qmlproject b/tests/manual/quickjumplist/quickjumplist.qmlproject deleted file mode 100644 index e5a8bf0..0000000 --- a/tests/manual/quickjumplist/quickjumplist.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/tests/manual/quicktaskbar/main.qml b/tests/manual/quicktaskbar/main.qml deleted file mode 100644 index 9dbbb88..0000000 --- a/tests/manual/quicktaskbar/main.qml +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.1 -import QtWinExtras 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 - -ApplicationWindow { - id: window - - title: "TaskbarButton" - - width: column.implicitWidth + 240 - height: column.implicitHeight + 160 - minimumWidth: column.implicitWidth + 40 - minimumHeight: column.implicitHeight + 40 - - TaskbarButton { - id: taskbar - - progress.visible: progressBox.checked - progress.minimum: indeterminateBox.checked ? 0 : minSpinBox.value - progress.maximum: indeterminateBox.checked ? 0 : maxSpinBox.value - progress.value: indeterminateBox.checked ? 0 : valueSlider.value - - overlay.iconSource: overlayBox.checked && overlayCombo.currentIndex >= 0 ? overlayModel.get(overlayCombo.currentIndex).source : "" - overlay.accessibleDescription: "TaskbarButton" - } - - ColumnLayout { - id: column - - spacing: 20 - anchors.centerIn: parent - Layout.preferredWidth: window.width / 2 - - GroupBox { - id: overlayBox - - checked: false - checkable: true - title: "Overlay icon" - Layout.fillWidth: true - - ComboBox { - id: overlayCombo - - anchors.fill: parent - anchors.margins: 10 - - textRole: "name" - model: ListModel { - id: overlayModel - ListElement { name: "Qt logo (64)"; source: "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" } - ListElement { name: "Up (16)"; source: "qrc:/qt-project.org/styles/commonstyle/images/up-16.png" } - ListElement { name: "Left (32)"; source: "qrc:/qt-project.org/styles/commonstyle/images/left-32.png" } - ListElement { name: "Right (32)"; source: "qrc:/qt-project.org/styles/commonstyle/images/right-32.png" } - ListElement { name: "Down (128)"; source: "qrc:/qt-project.org/styles/commonstyle/images/down-128.png" } - ListElement { name: "Remote"; source: "http://qt-project.org/images/qt13a/Qt-logo.png" } - ListElement { name: "Non-existing"; source: "do not crash explorer" } - } - } - } - - GroupBox { - id: progressBox - - checked: false - checkable: true - title: qsTr("Progress (%1)").arg(taskbar.progress.value) - Layout.fillWidth: true - - GridLayout { - columns: 3 - rowSpacing: 10 - columnSpacing: 20 - anchors.fill: parent - anchors.margins: 10 - - Label { text: "Value:" } - Slider { - id: valueSlider - - value: 82 - stepSize: 1 - minimumValue: minSpinBox.value - maximumValue: maxSpinBox.value - enabled: !indeterminateBox.checked - Layout.columnSpan: 2 - } - - Label { text: "Minimum:" } - SpinBox { - id: minSpinBox - - value: 0 - stepSize: 1 - minimumValue: -1000 - maximumValue: 1000 - enabled: !indeterminateBox.checked - Layout.fillWidth: true - } - - Button { - readonly property string playSymbol: "\u25BA" // BLACK RIGHT-POINTING POINTER - readonly property string pauseSymbol: "\u25AE\u25AE" // BLACK VERTICAL RECTANGLE - readonly property string stopSymbol: "\u2587" // BLACK SQUARE - - text: taskbar.progress.stopped ? playSymbol : taskbar.progress.paused ? stopSymbol : pauseSymbol - onClicked: taskbar.progress.stopped ? taskbar.progress.resume() : taskbar.progress.paused ? taskbar.progress.stop() : taskbar.progress.pause() - Layout.fillHeight: true - Layout.rowSpan: 3 - } - - Label { text: "Maximum:" } - SpinBox { - id: maxSpinBox - - value: 100 - stepSize: 1 - minimumValue: -1000 - maximumValue: 1000 - enabled: !indeterminateBox.checked - Layout.fillWidth: true - } - - Item { Layout.fillWidth: true } - - CheckBox { - id: indeterminateBox - text: "Indeterminate" - } - } - } - } -} diff --git a/tests/manual/quicktaskbar/quicktaskbar.qmlproject b/tests/manual/quicktaskbar/quicktaskbar.qmlproject deleted file mode 100644 index e5a8bf0..0000000 --- a/tests/manual/quicktaskbar/quicktaskbar.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/tests/manual/quickthumbnail/main.qml b/tests/manual/quickthumbnail/main.qml deleted file mode 100644 index e73b59f..0000000 --- a/tests/manual/quickthumbnail/main.qml +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.1 -import QtWinExtras 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 - -ApplicationWindow { - id: window - - title: "ThumbnailToolBar" - - width: 800 - height: 400 - minimumWidth: 480 - minimumHeight: 320 - - ThumbnailToolBar { - id: toolBar - iconicThumbnailSource : "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" - iconicLivePreviewSource : "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" - - ThumbnailToolButton { - tooltip: "Button #1" - iconSource: "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" - } - - Component { - id: buttonComponent - ThumbnailToolButton { - iconSource: "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" - } - } - } - - RowLayout { - id: row - - spacing: 10 - anchors.margins: 10 - anchors.fill: parent - - Item { - width: window.width / 3 * 2 - Layout.fillWidth: true - Layout.fillHeight: true - - GroupBox { - anchors.fill: parent - title: qsTr("Buttons (%1)").arg(toolBar.count) - - ColumnLayout { - anchors.fill: parent - anchors.margins: 10 - - TableView { - id: tableView - - currentRow: 0 - model: toolBar.buttons - - Layout.fillWidth: true - Layout.fillHeight: true - - TableViewColumn { role: "tooltip"; title: "Tooltip"; width: 132 } - TableViewColumn { role: "iconSource"; title: "Icon"; width: 88 } - TableViewColumn { role: "visible"; title: "Visible"; width: 64 } - TableViewColumn { role: "enabled"; title: "Enabled"; width: 64 } - TableViewColumn { role: "interactive"; title: "Interactive"; width: 64 } - TableViewColumn { role: "flat"; title: "Flat"; width: 64 } - TableViewColumn { role: "dismissOnClick"; title: "Dismissable"; width: 64 } - } - - RowLayout { - spacing: 10 - anchors.horizontalCenter: parent.horizontalCenter - - ToolButton { - property int counter: 1 - - text: "Add" - onClicked: { - var btn = buttonComponent.createObject(toolBar) - btn.tooltip = qsTr("Button #%1").arg(++counter) - toolBar.addButton(btn) - tableView.currentRow = toolBar.count - 1 - } - } - - ToolButton { - text: "Remove" - enabled: toolBar.count > 0 && tableView.currentRow !== -1 - onClicked: { - toolBar.removeButton(toolBar.buttons[tableView.currentRow]) - } - } - - ToolButton { - text: "Clear" - enabled: toolBar.count > 0 - onClicked: { - toolBar.clear() - } - } - } - } - } - } - - Item { - Layout.fillHeight: true - width: repeater.count ? repeater.itemAt(0).implicitWidth : 0 - - Repeater { - id: repeater - - model: toolBar.buttons - - GroupBox { - title: "Properties" - - anchors.fill: parent - visible: index === tableView.currentRow - implicitWidth: grid.implicitWidth + 20 - - GridLayout { - id: grid - - columns: 2 - rowSpacing: 10 - columnSpacing: 10 - anchors.fill: parent - anchors.margins: 10 - - property ThumbnailToolButton button: toolBar.buttons[index] - - Label { text: "Tooltip:" } - TextField { - text: grid.button ? grid.button.tooltip : "" - onTextChanged: if (grid.button) grid.button.tooltip = text - Layout.fillWidth: true - } - - Label { text: "Icon:" } - ComboBox { - currentIndex: 1 - textRole: "name" - Layout.fillWidth: true - model: ListModel { - id: iconModel - ListElement { name: "None"; source: "" } - ListElement { name: "Qt logo (64)"; source: "qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png" } - ListElement { name: "Up (16)"; source: "qrc:/qt-project.org/styles/commonstyle/images/up-16.png" } - ListElement { name: "Left (32)"; source: "qrc:/qt-project.org/styles/commonstyle/images/left-32.png" } - ListElement { name: "Right (32)"; source: "qrc:/qt-project.org/styles/commonstyle/images/right-32.png" } - ListElement { name: "Down (128)"; source: "qrc:/qt-project.org/styles/commonstyle/images/down-128.png" } - ListElement { name: "Non-existing"; source: "something that does not exist" } - } - onCurrentIndexChanged: { - if (grid.button && currentIndex !== -1) - grid.button.iconSource = iconModel.get(currentIndex).source - } - } - - CheckBox { - text: "Visible" - checked: grid.button && grid.button.visible - onCheckedChanged: if (grid.button) grid.button.visible = checked - Layout.columnSpan: 2 - } - - CheckBox { - text: "Enabled" - checked: grid.button && grid.button.enabled - onCheckedChanged: if (grid.button) grid.button.enabled = checked - Layout.columnSpan: 2 - } - - CheckBox { - text: "Interactive" - checked: grid.button && grid.button.interactive - onCheckedChanged: if (grid.button) grid.button.interactive = checked - Layout.columnSpan: 2 - } - - CheckBox { - text: "Flat" - checked: grid.button && grid.button.flat - onCheckedChanged: if (grid.button) grid.button.flat = checked - Layout.columnSpan: 2 - } - - CheckBox { - text: "Dismissable" - checked: grid.button && grid.button.dismissOnClick - onCheckedChanged: if (grid.button) grid.button.dismissOnClick = checked - Layout.columnSpan: 2 - } - - Item { Layout.fillHeight: true } - } - } - } - } - } -} diff --git a/tests/manual/quickthumbnail/quickthumbnail.qmlproject b/tests/manual/quickthumbnail/quickthumbnail.qmlproject deleted file mode 100644 index e5a8bf0..0000000 --- a/tests/manual/quickthumbnail/quickthumbnail.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/tests/manual/thumbnail/.prev_CMakeLists.txt b/tests/manual/thumbnail/.prev_CMakeLists.txt deleted file mode 100644 index 9c1d8e3..0000000 --- a/tests/manual/thumbnail/.prev_CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Generated from thumbnail.pro. - -##################################################################### -## thumbnail Binary: -##################################################################### - -qt_add_executable(thumbnail - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras -) - -#### Keys ignored in scope 1:.:.:thumbnail.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/thumbnail/CMakeLists.txt b/tests/manual/thumbnail/CMakeLists.txt deleted file mode 100644 index 03c66c4..0000000 --- a/tests/manual/thumbnail/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Generated from thumbnail.pro. - -##################################################################### -## thumbnail Binary: -##################################################################### - -qt_add_manual_test(thumbnail # special case - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets - Qt::WinExtras -) - -#### Keys ignored in scope 1:.:.:thumbnail.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/thumbnail/main.cpp b/tests/manual/thumbnail/main.cpp deleted file mode 100644 index 8266a0a..0000000 --- a/tests/manual/thumbnail/main.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2016 The Qt Company Ltd. - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the test suite of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ - ** 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 https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** GNU General Public License Usage - ** Alternatively, this file may be used under the terms of the GNU - ** General Public License version 3 as published by the Free Software - ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT - ** included in the packaging of this file. Please review the following - ** information to ensure the GNU General Public License requirements will - ** be met: https://www.gnu.org/licenses/gpl-3.0.html. - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include <QApplication> -#include <QMainWindow> -#include <QPlainTextEdit> -#include <QMenuBar> -#include <QMenu> -#include <QAction> -#include <QStyle> -#include <QScreen> -#include <QShortcut> -#include <QPixmap> -#include <QPainter> -#include <QFontMetrics> -#include <QtWinExtras> -#include <QDebug> - -static QPixmap drawColoredPixmap(const QSize &size, const QColor &color, - const QString &text = QString()) -{ - QPixmap result(size); - result.fill(color); - QPainter painter(&result); - painter.drawRect(QRect(QPoint(0, 0), size - QSize(1, 1))); - if (!text.isEmpty()) { - QFont font = painter.font(); - font.setPointSize(20); - painter.setFont(font); - const QFontMetrics fontMetrics(font); - QRect boundingRect(fontMetrics.boundingRect(text)); - const int x = (size.width() - boundingRect.width()) / 2; - const int y = size.height() - (size.height() - boundingRect.height()) / 2; - painter.drawText(x, y, text); - } - return result; -} - -class MainWindow : public QMainWindow { - Q_OBJECT -public: - MainWindow(); - void initThumbnailToolBar(); - -public slots: - void testButtonClicked(); - void updateIconicThumbnailPixmap(); - void updateIconicLivePreviewPixmap(); - void logText(const QString &text); - -private: - QWinThumbnailToolBar *m_thumbnailToolBar; - QPlainTextEdit *m_logEdit; - QAction *m_enableIconicPixmapAction; - QAction *m_enableIconicLivePreviewAction; -}; - -MainWindow::MainWindow() - : m_thumbnailToolBar(new QWinThumbnailToolBar(this)) - , m_logEdit(new QPlainTextEdit) - , m_enableIconicPixmapAction(new QAction("Enable Iconic Pixmap", this)) - , m_enableIconicLivePreviewAction(new QAction("Enable LivePreview", this)) -{ - setMinimumWidth(400); - setWindowTitle(QStringLiteral("QWinThumbnailToolBar ") + QLatin1String(QT_VERSION_STR)); - QMenu *fileMenu = menuBar()->addMenu("&File"); - m_enableIconicPixmapAction->setCheckable(true); - m_enableIconicPixmapAction->setChecked(true); - m_enableIconicLivePreviewAction->setCheckable(true); - m_enableIconicLivePreviewAction->setChecked(true); - fileMenu->addAction(m_enableIconicPixmapAction); - fileMenu->addAction(m_enableIconicLivePreviewAction); - QAction *quitAction = fileMenu->addAction("&Quit"); - quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); - connect(quitAction, &QAction::triggered, QCoreApplication::quit); - setCentralWidget(m_logEdit); -} - -void MainWindow::initThumbnailToolBar() -{ - m_thumbnailToolBar->setWindow(windowHandle()); - auto *testButton = new QWinThumbnailToolButton(m_thumbnailToolBar); - testButton->setToolTip("Test"); - testButton->setIcon(style()->standardIcon(QStyle::SP_ComputerIcon)); - connect(testButton, &QWinThumbnailToolButton::clicked, this, &MainWindow::testButtonClicked); - m_thumbnailToolBar->addButton(testButton); - m_thumbnailToolBar->setIconicPixmapNotificationsEnabled(true); - connect(m_thumbnailToolBar, &QWinThumbnailToolBar::iconicLivePreviewPixmapRequested, - this, &MainWindow::updateIconicLivePreviewPixmap); - connect(m_thumbnailToolBar, &QWinThumbnailToolBar::iconicThumbnailPixmapRequested, - this, &MainWindow::updateIconicThumbnailPixmap); -} - -void MainWindow::logText(const QString &text) -{ - m_logEdit->appendPlainText(text); - qDebug("%s", qPrintable(text)); -} - -void MainWindow::testButtonClicked() -{ - static int n = 1; - logText(QStringLiteral("Clicked #") + QString::number(n++)); -} - -void MainWindow::updateIconicThumbnailPixmap() -{ - static int n = 1; - if (!m_enableIconicPixmapAction->isChecked()) - return; - const QString number = QString::number(n++); - logText(QLatin1String(__FUNCTION__) + u' ' + number); - const QPixmap pixmap = - drawColoredPixmap(QSize(200, 50), Qt::yellow, QStringLiteral("ITP ") + number); - m_thumbnailToolBar->setIconicThumbnailPixmap(pixmap); -} - -void MainWindow::updateIconicLivePreviewPixmap() -{ - static int n = 1; - if (!m_enableIconicLivePreviewAction->isChecked()) - return; - const QString number = QString::number(n++); - logText(QLatin1String(__FUNCTION__) + u' ' + number); - const QPixmap pixmap = - drawColoredPixmap(QSize(200, 50), Qt::red, QStringLiteral("ILP ") + number); - m_thumbnailToolBar->setIconicLivePreviewPixmap(pixmap); -} - -int main(int argc, char* argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.move(QGuiApplication::primaryScreen()->availableGeometry().center() - - QPoint(w.width() / 2, w.height() / 2)); - w.show(); - w.initThumbnailToolBar(); - return a.exec(); -} - -#include "main.moc" diff --git a/tests/manual/thumbnail/thumbnail.pro b/tests/manual/thumbnail/thumbnail.pro deleted file mode 100644 index 2259b9b..0000000 --- a/tests/manual/thumbnail/thumbnail.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = app -QT += widgets winextras -CONFIG -= app_bundle -SOURCES += main.cpp diff --git a/tests/tests.pro b/tests/tests.pro deleted file mode 100644 index 1a05245..0000000 --- a/tests/tests.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -win32: SUBDIRS += auto manual |