diff options
Diffstat (limited to 'tests/manual')
8 files changed, 244 insertions, 20 deletions
diff --git a/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp b/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp index 0694003e0a..0d1014a6ff 100644 --- a/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp +++ b/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp @@ -130,7 +130,7 @@ void DownloadManager::proxyAuthenticationRequired(const QNetworkProxy &, QAuthen } #ifndef QT_NO_SSL -void DownloadManager::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors) +void DownloadManager::sslErrors(QNetworkReply *, const QList<QSslError> &errors) { qDebug() << "sslErrors"; foreach (const QSslError &error, errors) { diff --git a/tests/manual/qnetworkreply/main.cpp b/tests/manual/qnetworkreply/main.cpp index 9d199c3755..f91309502b 100644 --- a/tests/manual/qnetworkreply/main.cpp +++ b/tests/manual/qnetworkreply/main.cpp @@ -180,6 +180,8 @@ void tst_qnetworkreply::setSslConfiguration() QCOMPARE(rootCertLoadingAllowed, true); #elif defined(Q_OS_MAC) QCOMPARE(rootCertLoadingAllowed, false); +#else + Q_UNUSED(rootCertLoadingAllowed) #endif // other platforms: undecided (Windows: depends on the version) if (works) { QCOMPARE(reply->error(), QNetworkReply::NoError); diff --git a/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp b/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp index e2b2373e76..bdae3751e7 100644 --- a/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp +++ b/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp @@ -35,6 +35,7 @@ #include <QtGui/QPainter> #include <QtGui/QOpenGLTexture> +#include <QtGui/QOpenGLFunctions> #include <QtGui/QMatrix4x4> #include <QtCore/QCoreApplication> @@ -67,10 +68,11 @@ void QOpenGLTextureBlitWindow::render() m_context->makeCurrent(this); QRect viewport(0,0,dWidth(),dHeight()); - glViewport(0,0,dWidth(), dHeight()); + QOpenGLFunctions *functions = m_context->functions(); + functions->glViewport(0,0,dWidth(), dHeight()); - glClearColor(0.f, .6f, .0f, 0.f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + functions->glClearColor(0.f, .6f, .0f, 0.f); + functions->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); QOpenGLTexture texture(m_image); texture.setWrapMode(QOpenGLTexture::ClampToEdge); diff --git a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp b/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp index cfe24a25da..e01e2cec5e 100644 --- a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp +++ b/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp @@ -33,6 +33,148 @@ #include <QtWidgets/QtWidgets> +struct ManualTask { + const char *title; + const char *instructions; + unsigned sectionsMovable : 1; + unsigned selectionMode : 3; +}; + +ManualTask tasks[] = { +{ QT_TR_NOOP("0. Default"), + "Please provide instructions", + true, QAbstractItemView::SingleSelection +}, +{ QT_TR_NOOP("1. Autoscroll"), + "<ol>" + "<li>Press and hold on section 9 of vertical header.<br/>" + "<em>(all cells in the row will be selected)</em>" + "</li>" + "<li>Extend the selection by moving the mouse down.<br/>" + "<em>(selection will extend to the next rows)</em>" + "</li>" + "<li>Continue to move the mouse down and outside the window geometry.<br/>" + "<em>(The view should scroll automatically and the selection should still extend)</em>" + "</li>" + "<li>While still holding the button, do the same in the opposite direction, i.e. move mouse up and outside the window geometry.<br/>" + "<em>(Verify that the view scrolls automatically and the selection changes)</em>" + "</li>" + "<li>Verify that it works in the other dimension, i.e Press and hold section 9 of the horizontal header.<br/>" + "<em>All cells in the column will be selected</em>" + "</li>" + "<li>Extend the selection by moving the mouse to the far right and outside the window geometry.<br/>" + "<em>(selection will extend to the next columns)</em>" + "</li>" + "<li>Verify that it works in the opposite direction (i.e. move mouse to the left of the window geometry).<br/>" + "<em>(Verify that the view scrolls automatically and the selection changes)</em>" + "</li>" + "</ol>", + false, QAbstractItemView::ExtendedSelection +} + +}; + + +class Window : public QWidget +{ + Q_OBJECT +public: + Window(QWidget *parent = 0): QWidget(parent), ckMovable(0), tableView(0), cbSelectionMode(0), m_taskInstructions(0) + { + m_taskInstructions = new QLabel(); + if (sizeof(tasks) > 0) + m_taskInstructions->setText(tr(tasks[0].instructions)); + + QVBoxLayout *vbox = new QVBoxLayout(this); + vbox->addLayout(setupComboBox()); + vbox->addWidget(setupGroupBox()); + vbox->addWidget(setupTableView()); + vbox->addWidget(m_taskInstructions); + } + + void updateControls() + { + ckMovable->setChecked(tableView->verticalHeader()->sectionsMovable()); + QAbstractItemView::SelectionMode sMode = tableView->selectionMode(); + cbSelectionMode->setCurrentIndex((int)sMode); + } + +private: + QFormLayout *setupComboBox() + { + QComboBox *combo = new QComboBox; + for (size_t i = 0; i < sizeof(tasks) / sizeof(tasks[0]); ++i) { + combo->addItem(tr(tasks[i].title)); + } + + connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(on_taskCombo_currentIndexChanged(int))); + QFormLayout *form = new QFormLayout; + form->addRow(tr("Choose task:"), combo); + return form; + } + + QGroupBox *setupGroupBox() + { + QGroupBox *grp = new QGroupBox(tr("Properties")); + QFormLayout *form = new QFormLayout; + grp->setLayout(form); + ckMovable = new QCheckBox; + ckMovable->setObjectName(QLatin1String("ckMovable")); + connect(ckMovable, SIGNAL(toggled(bool)), this, SLOT(on_ckMovable_toggled(bool))); + form->addRow(tr("SectionsMovable"), ckMovable); + + cbSelectionMode = new QComboBox; + cbSelectionMode->setObjectName(QLatin1String("cbSelectionMode")); + cbSelectionMode->addItems(QStringList() << QLatin1String("NoSelection") + << QLatin1String("SingleSelection") + << QLatin1String("MultiSelection") + << QLatin1String("ExtendedSelection") + << QLatin1String("ContiguousSelection") + ); + + connect(cbSelectionMode, SIGNAL(currentIndexChanged(int)), this, SLOT(on_cbSelectionMode_currentIndexChanged(int))); + form->addRow(tr("SelectionMode"), cbSelectionMode); + return grp; + } + + QTableView *setupTableView() + { + tableView = new QTableView; + m.setRowCount(500); + m.setColumnCount(250); + tableView->setSelectionMode(QAbstractItemView::SingleSelection); + tableView->setModel(&m); + return tableView; + } + +private Q_SLOTS: + void on_ckMovable_toggled(bool arg) + { + tableView->verticalHeader()->setSectionsMovable(arg); + tableView->horizontalHeader()->setSectionsMovable(arg); + } + + void on_cbSelectionMode_currentIndexChanged(int idx) + { + tableView->setSelectionMode((QAbstractItemView::SelectionMode)idx); + } + + void on_taskCombo_currentIndexChanged(int idx) + { + ManualTask &task = tasks[idx]; + m_taskInstructions->setText(tr(task.instructions)); + ckMovable->setChecked(task.sectionsMovable); + cbSelectionMode->setCurrentIndex((QAbstractItemView::SelectionMode)task.selectionMode); + } + +public: + QCheckBox *ckMovable; + QTableView *tableView; + QStandardItemModel m; + QComboBox *cbSelectionMode; + QLabel *m_taskInstructions; +}; + class SomeHandler : public QObject { Q_OBJECT @@ -86,19 +228,18 @@ void SomeHandler::slotSectionResized(int logsection, int oldsize, int newsize) int main(int argc, char *argv[]) { QApplication app(argc, argv); - QTableView tv; - QStandardItemModel m; - m.setRowCount(500); - m.setColumnCount(250); - tv.setModel(&m); - tv.setSelectionMode(QAbstractItemView::SingleSelection); + Window window; // Comment in the line below to test selection with keyboard (space) // tv.setEditTriggers(QAbstractItemView::NoEditTriggers); - SomeHandler handler(tv.horizontalHeader(), &tv); - tv.horizontalHeader()->setDefaultSectionSize(30); - tv.show(); - tv.horizontalHeader()->setSectionsMovable(true); - tv.verticalHeader()->setSectionsMovable(true); + QHeaderView *hHeader = window.tableView->horizontalHeader(); + QHeaderView *vHeader = window.tableView->verticalHeader(); + SomeHandler handler(hHeader, window.tableView); + hHeader->setDefaultSectionSize(30); + window.resize(600, 600); + window.show(); + hHeader->setSectionsMovable(true); + vHeader->setSectionsMovable(true); + window.updateControls(); app.exec(); } #include "qheaderviewtest1.moc" diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp index 2fcc205ca7..9975bc9673 100644 --- a/tests/manual/windowflags/controllerwindow.cpp +++ b/tests/manual/windowflags/controllerwindow.cpp @@ -102,7 +102,7 @@ ControllerWindow::ControllerWindow() : previewWidget(0) updatePreview(); } -bool ControllerWindow::eventFilter(QObject *o, QEvent *e) +bool ControllerWindow::eventFilter(QObject *, QEvent *e) { if (e->type() == QEvent::WindowStateChange) updateStateControl(); diff --git a/tests/manual/windowtransparency/windowtransparency.cpp b/tests/manual/windowtransparency/windowtransparency.cpp index 3d5e607423..af9ccba707 100644 --- a/tests/manual/windowtransparency/windowtransparency.cpp +++ b/tests/manual/windowtransparency/windowtransparency.cpp @@ -85,9 +85,10 @@ public: "}"); prog.bind(); - glClearColor(0, 0, 0, 1); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, width(), height()); + QOpenGLFunctions *functions = gl->functions(); + functions->glClearColor(0, 0, 0, 0); + functions->glClear(GL_COLOR_BUFFER_BIT); + functions->glViewport(0, 0, width(), height()); prog.enableAttributeArray("a_Pos"); prog.enableAttributeArray("a_Color"); @@ -104,7 +105,7 @@ public: prog.setAttributeArray("a_Pos", GL_FLOAT, coords, 2, 0); prog.setAttributeArray("a_Color", GL_FLOAT, colors, 4, 0); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + functions->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); prog.disableAttributeArray("a_Pos"); prog.disableAttributeArray("a_Color"); diff --git a/tests/manual/xcb_gl_integration/main.cpp b/tests/manual/xcb_gl_integration/main.cpp new file mode 100644 index 0000000000..5e819ef1ca --- /dev/null +++ b/tests/manual/xcb_gl_integration/main.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 <QtGui/QGuiApplication> +#include <QtGui/QWindow> +#include <QtGui/QOpenGLContext> + +#include <QtGui/qpa/qplatformnativeinterface.h> + +#include <QtCore/QDebug> + +int main (int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + QWindow window; + window.setSurfaceType(QSurface::OpenGLSurface); + window.create(); + + QOpenGLContext context; + context.create(); + + QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface(); + + qDebug() << "EGLDisplay" << ni->nativeResourceForWindow(QByteArrayLiteral("egldisplay"), &window); + qDebug() << "EGLContext" << ni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), &context); + qDebug() << "EGLConfig" << ni->nativeResourceForContext(QByteArrayLiteral("eglconfig"), &context); + qDebug() << "GLXContext" << ni->nativeResourceForContext(QByteArrayLiteral("glxcontext"), &context); + qDebug() << "GLXConfig" << ni->nativeResourceForContext(QByteArrayLiteral("glxconfig"), &context); + + return 0; +} diff --git a/tests/manual/xcb_gl_integration/xcb_gl_integration.pro b/tests/manual/xcb_gl_integration/xcb_gl_integration.pro new file mode 100644 index 0000000000..0dd3df176f --- /dev/null +++ b/tests/manual/xcb_gl_integration/xcb_gl_integration.pro @@ -0,0 +1,8 @@ +TEMPLATE = app +TARGET = xcb_gl_integration +INCLUDEPATH += . + +QT += gui-private + +# Input +SOURCES += main.cpp |