summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/manual.pro1
-rw-r--r--tests/manual/qopenglwidget/openglwidget/openglwidget.cpp9
-rw-r--r--tests/manual/qpainfo/main.cpp232
-rw-r--r--tests/manual/qpainfo/qpainfo.pro7
-rw-r--r--tests/manual/qprintdevice_dump/main.cpp181
-rw-r--r--tests/manual/qprintdevice_dump/qprintdevice_dump.pro6
6 files changed, 192 insertions, 244 deletions
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 62722ea62b..9318824e6d 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -22,7 +22,6 @@ qnetworkaccessmanager/qget \
qnetworkconfigurationmanager \
qnetworkconfiguration \
qnetworkreply \
-qpainfo \
qscreen \
qssloptions \
qsslsocket \
diff --git a/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp b/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp
index 5752326911..bec89b6b41 100644
--- a/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp
+++ b/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp
@@ -61,8 +61,8 @@
class OpenGLWidgetPrivate
{
public:
- OpenGLWidgetPrivate()
- : m_program(0), m_frame(0)
+ OpenGLWidgetPrivate(QWidget *q)
+ : m_program(0), m_frame(0), q(q)
{
}
@@ -82,13 +82,14 @@ public:
int m_frame;
int w,h;
+ QWidget *q;
};
OpenGLWidget::OpenGLWidget(QWidget *parent)
: QOpenGLWidget(parent)
{
- d = new OpenGLWidgetPrivate;
+ d = new OpenGLWidgetPrivate(this);
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(updateGL()));
timer->start(30);
@@ -147,7 +148,7 @@ void OpenGLWidgetPrivate::initialize()
void OpenGLWidgetPrivate::render()
{
- const qreal retinaScale = 1.0;//devicePixelRatio();
+ const qreal retinaScale = q->devicePixelRatio();
glViewport(0, 0, width() * retinaScale, height() * retinaScale);
glClearColor(0.0, 0.0, 0.0, 1.0);
diff --git a/tests/manual/qpainfo/main.cpp b/tests/manual/qpainfo/main.cpp
deleted file mode 100644
index 02ac88dd06..0000000000
--- a/tests/manual/qpainfo/main.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-#include <QStyleHints>
-#include <QLibraryInfo>
-#include <private/qguiapplication_p.h>
-#include <qpa/qplatformintegration.h>
-#include <qpa/qplatformtheme.h>
-#include <QScreen>
-#include <QStringList>
-#include <QVariant>
-#include <QFont>
-#include <QFontDatabase>
-#include <QSysInfo>
-#include <QLibraryInfo>
-#include <QStandardPaths>
-#include <QDir>
-
-#include <iostream>
-#include <string>
-
-std::ostream &operator<<(std::ostream &str, const QSize &s)
-{
- str << s.width() << 'x' << s.height();
- return str;
-}
-
-std::ostream &operator<<(std::ostream &str, const QSizeF &s)
-{
- str << s.width() << 'x' << s.height();
- return str;
-}
-
-std::ostream &operator<<(std::ostream &str, const QRect &r)
-{
- str << r.size() << '+' << r.x() << '+' << r.y();
- return str;
-}
-
-std::ostream &operator<<(std::ostream &str, const QStringList &l)
-{
- for (int i = 0; i < l.size(); ++i) {
- if (i)
- str << ',';
- str << l.at(i).toStdString();
- }
- return str;
-}
-
-std::ostream &operator<<(std::ostream &str, const QFont &f)
-{
- std::cout << '"' << f.family().toStdString() << "\" " << f.pointSize();
- return str;
-}
-
-static QStringList toNativeSeparators(QStringList in)
-{
- for (int i = 0; i < in.size(); ++i)
- in[i] = QDir::toNativeSeparators(in.at(i));
- return in;
-}
-
-#define DUMP_CAPABILITY(integration, capability) \
- if (platformIntegration->hasCapability(QPlatformIntegration::capability)) \
- std::cout << ' ' << #capability;
-
-#define DUMP_STANDARDPATH(location) \
- std::cout << " " << #location << ": \"" \
- << QStandardPaths::displayName(QStandardPaths::location).toStdString() << '"' \
- << ' ' << toNativeSeparators(QStandardPaths::standardLocations(QStandardPaths::location)) << '\n';
-
-#define DUMP_LIBRARYPATH(loc) \
- std::cout << " " << #loc << ": " << QDir::toNativeSeparators(QLibraryInfo::location(QLibraryInfo::loc)).toStdString() << '\n';
-
-int main(int argc, char **argv)
-{
- QGuiApplication app(argc, argv);
-
- const QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();
- std::cout << QLibraryInfo::build() << " on \"" << QGuiApplication::platformName().toStdString() << "\" "
- << (QSysInfo::ByteOrder == QSysInfo::LittleEndian ? "little endian" : "big endian") << '/'
- << '\n';
-
-#if defined(Q_OS_WIN)
- std::cout << std::hex << "Windows version: 0x" << QSysInfo::windowsVersion() << std::dec << '\n';
-#elif defined(Q_OS_MAC)
- std::cout << std::hex << "Mac OS version: 0x" << QSysInfo::macVersion() << std::dec << '\n';
-#endif
-
- std::cout << "\nLibrary info:\n";
- DUMP_LIBRARYPATH(PrefixPath)
- DUMP_LIBRARYPATH(DocumentationPath)
- DUMP_LIBRARYPATH(HeadersPath)
- DUMP_LIBRARYPATH(LibrariesPath)
- DUMP_LIBRARYPATH(LibraryExecutablesPath)
- DUMP_LIBRARYPATH(BinariesPath)
- DUMP_LIBRARYPATH(PluginsPath)
- DUMP_LIBRARYPATH(ImportsPath)
- DUMP_LIBRARYPATH(Qml2ImportsPath)
- DUMP_LIBRARYPATH(ArchDataPath)
- DUMP_LIBRARYPATH(DataPath)
- DUMP_LIBRARYPATH(TranslationsPath)
- DUMP_LIBRARYPATH(ExamplesPath)
- DUMP_LIBRARYPATH(TestsPath)
-
- std::cout << "\nStandard paths:\n";
- DUMP_STANDARDPATH(DesktopLocation)
- DUMP_STANDARDPATH(DocumentsLocation)
- DUMP_STANDARDPATH(FontsLocation)
- DUMP_STANDARDPATH(ApplicationsLocation)
- DUMP_STANDARDPATH(MusicLocation)
- DUMP_STANDARDPATH(MoviesLocation)
- DUMP_STANDARDPATH(PicturesLocation)
- DUMP_STANDARDPATH(TempLocation)
- DUMP_STANDARDPATH(HomeLocation)
- DUMP_STANDARDPATH(DataLocation)
- DUMP_STANDARDPATH(CacheLocation)
- DUMP_STANDARDPATH(GenericDataLocation)
- DUMP_STANDARDPATH(RuntimeLocation)
- DUMP_STANDARDPATH(ConfigLocation)
- DUMP_STANDARDPATH(DownloadLocation)
- DUMP_STANDARDPATH(GenericCacheLocation)
-
- std::cout << "\nPlatform capabilities:";
- DUMP_CAPABILITY(platformIntegration, ThreadedPixmaps)
- DUMP_CAPABILITY(platformIntegration, OpenGL)
- DUMP_CAPABILITY(platformIntegration, ThreadedOpenGL)
- DUMP_CAPABILITY(platformIntegration, SharedGraphicsCache)
- DUMP_CAPABILITY(platformIntegration, BufferQueueingOpenGL)
- DUMP_CAPABILITY(platformIntegration, WindowMasks)
- DUMP_CAPABILITY(platformIntegration, MultipleWindows)
- DUMP_CAPABILITY(platformIntegration, ApplicationState)
- DUMP_CAPABILITY(platformIntegration, ForeignWindows)
- DUMP_CAPABILITY(platformIntegration, AllGLFunctionsQueryable)
- std::cout << '\n';
-
- const QStyleHints *styleHints = QGuiApplication::styleHints();
- std::cout << "\nStyle hints: mouseDoubleClickInterval=" << styleHints->mouseDoubleClickInterval() << " startDragDistance="
- << styleHints->startDragDistance() << " startDragTime=" << styleHints->startDragTime()
- << " startDragVelocity=" << styleHints->startDragVelocity() << " keyboardInputInterval=" << styleHints->keyboardInputInterval()
- << " keyboardAutoRepeatRate=" << styleHints->keyboardAutoRepeatRate() << " cursorFlashTime=" << styleHints->cursorFlashTime()
- << " showIsFullScreen=" << styleHints->showIsFullScreen() << " passwordMaskDelay=" << styleHints->passwordMaskDelay()
- << " fontSmoothingGamma=" << styleHints->fontSmoothingGamma() << " useRtlExtensions=" << styleHints->useRtlExtensions()
- << " mousePressAndHoldInterval=" << styleHints->mousePressAndHoldInterval() << '\n';
-
- const QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme();
- std::cout << "\nTheme:\n Styles: " << platformTheme->themeHint(QPlatformTheme::StyleNames).toStringList();
- const QString iconTheme = platformTheme->themeHint(QPlatformTheme::SystemIconThemeName).toString();
- if (!iconTheme.isEmpty()) {
- std::cout << "\n Icon theme: " << iconTheme.toStdString()
- << ", " << platformTheme->themeHint(QPlatformTheme::SystemIconFallbackThemeName).toString().toStdString()
- << " from " << platformTheme->themeHint(QPlatformTheme::IconThemeSearchPaths).toStringList() << '\n';
- }
- if (const QFont *systemFont = platformTheme->font())
- std::cout << " System font: " << *systemFont<< '\n';
- std::cout << " General font : " << QFontDatabase::systemFont(QFontDatabase::GeneralFont) << '\n'
- << " Fixed font : " << QFontDatabase::systemFont(QFontDatabase::FixedFont) << '\n'
- << " Title font : " << QFontDatabase::systemFont(QFontDatabase::TitleFont) << '\n'
- << " Smallest font: " << QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont) << "\n\n";
-
- if (platformTheme->usePlatformNativeDialog(QPlatformTheme::FileDialog))
- std::cout << " Native file dialog\n";
- if (platformTheme->usePlatformNativeDialog(QPlatformTheme::ColorDialog))
- std::cout << " Native color dialog\n";
- if (platformTheme->usePlatformNativeDialog(QPlatformTheme::FontDialog))
- std::cout << " Native font dialog\n";
-
- const QList<QScreen*> screens = QGuiApplication::screens();
- const int screenCount = screens.size();
- std::cout << "\nScreens: " << screenCount << '\n';
- for (int s = 0; s < screenCount; ++s) {
- const QScreen *screen = screens.at(s);
- std::cout << (screen == QGuiApplication::primaryScreen() ? '*' : ' ')
- << '#' << ' ' << s << " \"" << screen->name().toStdString() << '"'
- << "\n Geometry: " << screen->geometry() << " Available: " << screen->availableGeometry();
- if (screen->geometry() != screen->virtualGeometry())
- std::cout << "\n Virtual geometry: " << screen->virtualGeometry() << " Available: " << screen->availableVirtualGeometry();
- if (screen->virtualSiblings().size() > 1)
- std::cout << "\n " << screen->virtualSiblings().size() << " virtual siblings";
- std::cout << "\n Physical size: " << screen->physicalSize() << " mm"
- << " Refresh: " << screen->refreshRate() << " Hz"
- << "\n Physical DPI: " << screen->physicalDotsPerInchX()
- << ',' << screen->physicalDotsPerInchY()
- << " Logical DPI: " << screen->logicalDotsPerInchX()
- << ',' << screen->logicalDotsPerInchY()
- << "\n DevicePixelRatio: " << screen->devicePixelRatio()
- << " Primary orientation: " << screen->primaryOrientation()
- << "\n Orientation: " << screen->orientation()
- << " OrientationUpdateMask: " << screen->orientationUpdateMask()
- << "\n\n";
- }
- return 0;
-}
diff --git a/tests/manual/qpainfo/qpainfo.pro b/tests/manual/qpainfo/qpainfo.pro
deleted file mode 100644
index 374f951300..0000000000
--- a/tests/manual/qpainfo/qpainfo.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-TARGET = qpainfo
-CONFIG+=console
-CONFIG -= app_bundle
-QT = core-private gui-private
-
-SOURCES += main.cpp
diff --git a/tests/manual/qprintdevice_dump/main.cpp b/tests/manual/qprintdevice_dump/main.cpp
new file mode 100644
index 0000000000..930c851d65
--- /dev/null
+++ b/tests/manual/qprintdevice_dump/main.cpp
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 John Layt <jlayt@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qpa/qplatformprintplugin.h>
+#include <qpa/qplatformprintersupport.h>
+
+#include <private/qprintdevice_p.h>
+
+#include <QApplication>
+#include <QMimeType>
+#include <QDebug>
+
+/*
+ This test is designed to dump the current printer configuration details
+ to output, to assist in debugging of print device problems.
+*/
+
+static QString stateToString(QPrint::DeviceState state)
+{
+ switch (state) {
+ case QPrint::Idle:
+ return QStringLiteral("Idle");
+ case QPrint::Active:
+ return QStringLiteral("Active");
+ case QPrint::Aborted:
+ return QStringLiteral("Aborted");
+ case QPrint::Error:
+ return QStringLiteral("Error");
+ }
+ return QStringLiteral("Invalid DeviceState");
+}
+
+static QString duplexToString(QPrint::DuplexMode duplex)
+{
+ switch (duplex) {
+ case QPrint::DuplexNone:
+ return QStringLiteral("DuplexNone");
+ case QPrint::DuplexAuto:
+ return QStringLiteral("DuplexAuto");
+ case QPrint::DuplexLongSide:
+ return QStringLiteral("DuplexLongSide");
+ case QPrint::DuplexShortSide:
+ return QStringLiteral("DuplexShortSide");
+ }
+ return QStringLiteral("Invalid DuplexMode");
+}
+
+static QString colorToString(QPrint::ColorMode color)
+{
+ switch (color) {
+ case QPrint::GrayScale:
+ return QStringLiteral("GrayScale");
+ case QPrint::Color:
+ return QStringLiteral("Color");
+ }
+ return QStringLiteral("Invalid ColorMode");
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ qDebug() << "\n********************************";
+ qDebug() << "***** QPrintDevice Details *****";
+ qDebug() << "********************************\n";
+
+ QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();
+ if (!ps) {
+ qDebug() << "Could not load platform plugin!";
+ return -1;
+ }
+
+ QString defaultId = ps->defaultPrintDeviceId();
+ if (defaultId.isEmpty())
+ qDebug() << "No default printer found";
+ else
+ qDebug() << "Default Printer ID :" << defaultId;
+ qDebug() << "Available Printer IDs :" << ps->availablePrintDeviceIds() << "\n";
+
+ foreach (const QString id, ps->availablePrintDeviceIds()) {
+ QPrintDevice printDevice = ps->createPrintDevice(id);
+ if (printDevice.isValid()) {
+ qDebug() << "===" << printDevice.id() << "===\n";
+ qDebug() << "Device ID :" << printDevice.id();
+ qDebug() << "Device Name :" << printDevice.name();
+ qDebug() << "Device Location :" << printDevice.location();
+ qDebug() << "Device Make :" << printDevice.makeAndModel();
+ qDebug() << "";
+ qDebug() << "isValid :" << printDevice.isValid();
+ qDebug() << "isDefault :" << printDevice.isDefault();
+ qDebug() << "isRemote :" << printDevice.isRemote();
+ qDebug() << "";
+ qDebug() << "state :" << stateToString(printDevice.state());
+ qDebug() << "";
+ qDebug() << "supportsMultipleCopies :" << printDevice.supportsMultipleCopies();
+ qDebug() << "supportsCollateCopies :" << printDevice.supportsCollateCopies();
+ qDebug() << "";
+ qDebug() << "defaultPageSize :" << printDevice.defaultPageSize();
+ qDebug() << "supportedPageSizes :";
+ foreach (const QPageSize &page, printDevice.supportedPageSizes())
+ qDebug() << " " << page << printDevice.printableMargins(page, QPageLayout::Portrait, 300);
+ qDebug() << "";
+ qDebug() << "supportsCustomPageSizes :" << printDevice.supportsCustomPageSizes();
+ qDebug() << "";
+ qDebug() << "minimumPhysicalPageSize :" << printDevice.minimumPhysicalPageSize();
+ qDebug() << "maximumPhysicalPageSize :" << printDevice.maximumPhysicalPageSize();
+ qDebug() << "";
+ qDebug() << "defaultResolution :" << printDevice.defaultResolution();
+ qDebug() << "supportedResolutions :" << printDevice.supportedResolutions();
+ qDebug() << "";
+ qDebug() << "defaultInputSlot :" << printDevice.defaultInputSlot().key
+ << printDevice.defaultInputSlot().name
+ << printDevice.defaultInputSlot().id;
+ qDebug() << "supportedInputSlots :";
+ foreach (const QPrint::InputSlot &slot, printDevice.supportedInputSlots())
+ qDebug() << " " << slot.key << slot.name << slot.id;
+ qDebug() << "";
+ qDebug() << "defaultOutputBin :" << printDevice.defaultOutputBin().key
+ << printDevice.defaultOutputBin().name
+ << printDevice.defaultOutputBin().id;
+ qDebug() << "supportedOutputBins :";
+ foreach (const QPrint::OutputBin &bin, printDevice.supportedOutputBins())
+ qDebug() << " " << bin.key << bin.name << bin.id;
+ qDebug() << "";
+ qDebug() << "defaultDuplexMode :" << duplexToString(printDevice.defaultDuplexMode());
+ qDebug() << "supportedDuplexModes :";
+ foreach (QPrint::DuplexMode mode, printDevice.supportedDuplexModes())
+ qDebug() << " " << duplexToString(mode);
+ qDebug() << "";
+ qDebug() << "defaultColorMode :" << colorToString(printDevice.defaultColorMode());
+ qDebug() << "supportedColorModes :";
+ foreach (QPrint::ColorMode mode, printDevice.supportedColorModes())
+ qDebug() << " " << colorToString(mode);
+ qDebug() << "";
+ qDebug() << "supportedMimeTypes :";
+ foreach (const QMimeType &type, printDevice.supportedMimeTypes())
+ qDebug() << " " << type.name();
+ } else {
+ qDebug() << "Create printer failed" << id;
+ }
+ qDebug() << "\n";
+ }
+}
diff --git a/tests/manual/qprintdevice_dump/qprintdevice_dump.pro b/tests/manual/qprintdevice_dump/qprintdevice_dump.pro
new file mode 100644
index 0000000000..c9d36d1d1f
--- /dev/null
+++ b/tests/manual/qprintdevice_dump/qprintdevice_dump.pro
@@ -0,0 +1,6 @@
+QT += printsupport-private
+
+TARGET = qprintdevice_dump
+TEMPLATE = app
+
+SOURCES += main.cpp