diff options
Diffstat (limited to 'tests/manual/lance')
-rw-r--r-- | tests/manual/lance/CMakeLists.txt | 86 | ||||
-rw-r--r-- | tests/manual/lance/README | 4 | ||||
-rw-r--r-- | tests/manual/lance/interactivewidget.cpp | 34 | ||||
-rw-r--r-- | tests/manual/lance/interactivewidget.h | 31 | ||||
-rw-r--r-- | tests/manual/lance/lance.pro | 6 | ||||
-rw-r--r-- | tests/manual/lance/main.cpp | 66 | ||||
-rw-r--r-- | tests/manual/lance/widgets.h | 43 |
7 files changed, 130 insertions, 140 deletions
diff --git a/tests/manual/lance/CMakeLists.txt b/tests/manual/lance/CMakeLists.txt new file mode 100644 index 0000000000..41eb18b6c2 --- /dev/null +++ b/tests/manual/lance/CMakeLists.txt @@ -0,0 +1,86 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## lance Binary: +##################################################################### + +qt_internal_add_manual_test(lance + SOURCES + ../../baseline/shared/paintcommands.cpp ../../baseline/shared/paintcommands.h + interactivewidget.cpp interactivewidget.h + main.cpp + widgets.h + NO_PCH_SOURCES + interactivewidget.cpp # undef QT_NO_FOREACH + INCLUDE_DIRECTORIES + . + ../../baseline/shared + LIBRARIES + Qt::CorePrivate + Qt::Gui + Qt::GuiPrivate + Qt::OpenGLWidgets + Qt::PrintSupport + Qt::Widgets +) + +# Resources: +set(icons_resource_files + "enum.png" + "tools.png" +) + +qt_internal_add_resource(lance "icons" + PREFIX + "/icons" + FILES + ${icons_resource_files} +) +set(images_resource_files + "../../baseline/painting/images/alpha.png" + "../../baseline/painting/images/alpha2x2.png" + "../../baseline/painting/images/bitmap.png" + "../../baseline/painting/images/border.png" + "../../baseline/painting/images/borderimage.png" + "../../baseline/painting/images/dome_argb32.png" + "../../baseline/painting/images/dome_indexed.png" + "../../baseline/painting/images/dome_indexed_mask.png" + "../../baseline/painting/images/dome_mono.png" + "../../baseline/painting/images/dome_mono_128.png" + "../../baseline/painting/images/dome_mono_palette.png" + "../../baseline/painting/images/dome_rgb32.png" + "../../baseline/painting/images/dot.png" + "../../baseline/painting/images/face.png" + "../../baseline/painting/images/gam030.png" + "../../baseline/painting/images/gam045.png" + "../../baseline/painting/images/gam056.png" + "../../baseline/painting/images/gam100.png" + "../../baseline/painting/images/gam200.png" + "../../baseline/painting/images/image.png" + "../../baseline/painting/images/mask.png" + "../../baseline/painting/images/mask_100.png" + "../../baseline/painting/images/masked.png" + "../../baseline/painting/images/sign.png" + "../../baseline/painting/images/solid.png" + "../../baseline/painting/images/solid2x2.png" + "../../baseline/painting/images/struct-image-01.jpg" + "../../baseline/painting/images/struct-image-01.png" + "../../baseline/painting/images/zebra.png" +) +qt_internal_add_resource(lance "images" + PREFIX + "/" + BASE + "../../baseline/painting" + FILES + ${images_resource_files} +) + +## Scopes: +##################################################################### + +qt_internal_extend_target(lance CONDITION TARGET Qt::OpenGL + LIBRARIES + Qt::OpenGL +) diff --git a/tests/manual/lance/README b/tests/manual/lance/README index 6e89b29b08..68a9d647bc 100644 --- a/tests/manual/lance/README +++ b/tests/manual/lance/README @@ -1,6 +1,6 @@ The "lance" tool can be used to edit and run QPainter script (.qps) files. They are used in the "lancelot" qpainter regression autotest. -A collection of scripts can be found in the directory -tests/auto/lancelot/scripts +A collection of scripts can be found in subdirectories under +tests/baseline See lance -help for options. diff --git a/tests/manual/lance/interactivewidget.cpp b/tests/manual/lance/interactivewidget.cpp index d172fac900..03bfca8566 100644 --- a/tests/manual/lance/interactivewidget.cpp +++ b/tests/manual/lance/interactivewidget.cpp @@ -1,30 +1,8 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses + #include "interactivewidget.h" #include <QtWidgets> @@ -40,7 +18,7 @@ InteractiveWidget::InteractiveWidget() QWidget *panelContent = new QWidget(); QVBoxLayout *vlayout = new QVBoxLayout(panelContent); - vlayout->setMargin(0); + vlayout->setContentsMargins(0, 0, 0, 0); vlayout->setSpacing(0); // create and populate the command toolbox diff --git a/tests/manual/lance/interactivewidget.h b/tests/manual/lance/interactivewidget.h index 442f372db7..b11c6cfee2 100644 --- a/tests/manual/lance/interactivewidget.h +++ b/tests/manual/lance/interactivewidget.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef INTERACTIVEWIDGET_H #define INTERACTIVEWIDGET_H @@ -50,7 +25,7 @@ public slots: void save(); protected: - bool eventFilter(QObject *o, QEvent *e); + bool eventFilter(QObject *o, QEvent *e) override; protected slots: void cmdSelected(QListWidgetItem *item); diff --git a/tests/manual/lance/lance.pro b/tests/manual/lance/lance.pro index 78ca2f56e5..68f5368f7d 100644 --- a/tests/manual/lance/lance.pro +++ b/tests/manual/lance/lance.pro @@ -1,8 +1,8 @@ -LANCELOT_DIR = $$PWD/../../auto/other/lancelot +LANCELOT_DIR = $$[QT_HOST_PREFIX]/tests/baseline/shared CONFIG += cmdline moc TEMPLATE = app INCLUDEPATH += . $$LANCELOT_DIR -QT += core-private gui-private widgets printsupport +QT += core-private gui-private widgets printsupport openglwidgets HEADERS += widgets.h \ interactivewidget.h \ @@ -11,7 +11,7 @@ SOURCES += interactivewidget.cpp \ main.cpp \ $$LANCELOT_DIR/paintcommands.cpp RESOURCES += icons.qrc \ - $$LANCELOT_DIR/images.qrc + $$LANCELOT_DIR/../painting/images.qrc qtHaveModule(opengl): QT += opengl diff --git a/tests/manual/lance/main.cpp b/tests/manual/lance/main.cpp index 6dc5e2076a..f39001f3c2 100644 --- a/tests/manual/lance/main.cpp +++ b/tests/manual/lance/main.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "interactivewidget.h" #include "widgets.h" #include "paintcommands.h" @@ -42,8 +17,9 @@ #endif #ifndef QT_NO_OPENGL -#include <qgl.h> -#include <QGLPixelBuffer> +#include <QtOpenGL/QOpenGLFramebufferObjectFormat> +#include <QtOpenGL/QOpenGLPaintDevice> +#include <QtOpenGLWidgets/QOpenGLWidget> #endif // #define DO_QWS_DEBUGGING @@ -89,7 +65,7 @@ static void printHelp() " -imagemono Paints the files to a monochrome image\n" " -imagewidget same as image, but with interacion...\n" #ifndef QT_NO_OPENGL - " -opengl Paints the files to a QGLWidget (Qt4 style) on screen\n" + " -opengl Paints the files to a QOpenGLWidget on screen\n" " -glbuffer Paints the files to a QOpenGLFrameBufferObject (Qt5 style) \n" " -coreglbuffer Paints the files to a Core Profile context QOpenGLFrameBufferObject\n" #endif @@ -215,6 +191,7 @@ int main(int argc, char **argv) DeviceType type = WidgetType; QSurfaceFormat contextFormat; + contextFormat.setStencilBufferSize(8); bool checkers_background = true; QImage::Format imageFormat = QImage::Format_ARGB32_Premultiplied; @@ -233,12 +210,11 @@ int main(int argc, char **argv) bool verboseMode = false; #ifndef QT_NO_OPENGL - QGLFormat f = QGLFormat::defaultFormat(); - f.setSampleBuffers(true); - f.setStencil(true); - f.setAlpha(true); + QSurfaceFormat f = QSurfaceFormat::defaultFormat(); + f.setSamples(1); + f.setStencilBufferSize(8); f.setAlphaBufferSize(8); - QGLFormat::setDefaultFormat(f); + QSurfaceFormat::setDefaultFormat(f); #endif char *arg; @@ -364,7 +340,7 @@ int main(int argc, char **argv) if (file.open(QIODevice::ReadOnly)) { QTextStream textFile(&file); QString script = textFile.readAll(); - content = script.split("\n", QString::SkipEmptyParts); + content = script.split("\n", Qt::SkipEmptyParts); } else { printf("failed to read file: '%s'\n", qPrintable(fileinfo.absoluteFilePath())); continue; @@ -447,14 +423,14 @@ int main(int argc, char **argv) } case OpenGLType: { - OnScreenWidget<QGLWidget> *qGLWidget = new OnScreenWidget<QGLWidget>(files.at(j)); - qGLWidget->setVerboseMode(verboseMode); - qGLWidget->setType(type); - qGLWidget->setCheckersBackground(checkers_background); - qGLWidget->m_commands = content; - qGLWidget->resize(width, height); - qGLWidget->show(); - activeWidget = qGLWidget; + OnScreenWidget<QOpenGLWidget> *qOpenGLWidget = new OnScreenWidget<QOpenGLWidget>(files.at(j)); + qOpenGLWidget->setVerboseMode(verboseMode); + qOpenGLWidget->setType(type); + qOpenGLWidget->setCheckersBackground(checkers_background); + qOpenGLWidget->m_commands = content; + qOpenGLWidget->resize(width, height); + qOpenGLWidget->show(); + activeWidget = qOpenGLWidget; break; } #else @@ -633,7 +609,7 @@ int main(int argc, char **argv) + input.suffix() + QStringLiteral(".pdf"); p.setOutputFormat(QPrinter::PdfFormat); p.setOutputFileName(file); - p.setPageSize(QPrinter::A4); + p.setPageSize(QPageSize(QPageSize::A4)); QPainter pt(&p); pcmd.setPainter(&pt); pcmd.setFilePath(fileinfo.absolutePath()); diff --git a/tests/manual/lance/widgets.h b/tests/manual/lance/widgets.h index 09b2c3e667..ae2e75fbdc 100644 --- a/tests/manual/lance/widgets.h +++ b/tests/manual/lance/widgets.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef WIDGETS_H #define WIDGETS_H @@ -131,12 +106,12 @@ public: void setCheckersBackground(bool b) { m_checkersBackground = b; } void setType(DeviceType t) { m_deviceType = t; } - void resizeEvent(QResizeEvent *e) { + void resizeEvent(QResizeEvent *e) override { m_image = QImage(); T::resizeEvent(e); } - void paintEvent(QPaintEvent *) { + void paintEvent(QPaintEvent *) override { switch (m_view_mode) { case RenderView: paintRenderView(); break; case BaselineView: paintBaselineView(); break; @@ -254,7 +229,7 @@ public: } - void mouseMoveEvent(QMouseEvent *e) + void mouseMoveEvent(QMouseEvent *e) override { if (m_currentPoint == -1) return; @@ -263,7 +238,7 @@ public: T::update(); } - void mousePressEvent(QMouseEvent *e) + void mousePressEvent(QMouseEvent *e) override { if (e->button() == Qt::RightButton) { m_showControlPoints = true; @@ -280,7 +255,7 @@ public: T::update(); } - void mouseReleaseEvent(QMouseEvent *e) + void mouseReleaseEvent(QMouseEvent *e) override { if (e->button() == Qt::LeftButton) m_currentPoint = -1; @@ -289,9 +264,9 @@ public: T::update(); } - QSize sizeHint() const { return QSize(800, 800); } + QSize sizeHint() const override { return QSize(800, 800); } - QVector<QPointF> m_controlPoints; + QList<QPointF> m_controlPoints; int m_currentPoint; bool m_showControlPoints; |