summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/cocoa/qt_on_cocoa/main.mm2
-rw-r--r--tests/manual/manual.pro5
-rw-r--r--tests/manual/qopenglcontext/main.cpp54
-rw-r--r--tests/manual/qopenglcontext/qopenglcontext.pro9
-rw-r--r--tests/manual/qopenglcontext/qopenglcontextwindow.cpp173
-rw-r--r--tests/manual/qopenglcontext/qopenglcontextwindow.h76
-rw-r--r--tests/manual/qopenglcontext/qticon64.pngbin0 -> 6474 bytes
-rw-r--r--tests/manual/widgets/itemviews/itemviews.pro2
-rw-r--r--tests/manual/widgets/itemviews/qheaderview/qheaderview.pro (renamed from tests/manual/widgets/itemviews/qheaderview/qheaderviewtest.pro)0
-rw-r--r--tests/manual/widgets/itemviews/qtreeview/qtreeview.pro (renamed from tests/manual/widgets/itemviews/qtreeview/qtreeviewtest.pro)0
-rw-r--r--tests/manual/widgets/itemviews/qtreewidget/qtreewidget.pro (renamed from tests/manual/widgets/itemviews/qtreewidget/qtreewidgettest.pro)0
-rw-r--r--tests/manual/widgets/itemviews/tableview-span-navigation/main.cpp67
-rw-r--r--tests/manual/widgets/itemviews/tableview-span-navigation/tableview-span-navigation.pro8
-rw-r--r--tests/manual/widgets/kernel/layoutreplace/layoutreplace.pro (renamed from tests/manual/widgets/kernel/layoutreplace/main.pro)0
-rw-r--r--tests/manual/widgets/kernel/qtooltip/qtooltip.pro (renamed from tests/manual/widgets/kernel/qtooltip/main.pro)0
-rw-r--r--tests/manual/widgets/qgraphicsview/rubberband/rubberband.pro (renamed from tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.pro)0
16 files changed, 393 insertions, 3 deletions
diff --git a/tests/manual/cocoa/qt_on_cocoa/main.mm b/tests/manual/cocoa/qt_on_cocoa/main.mm
index 9a39788b02..7b4d4dd8d5 100644
--- a/tests/manual/cocoa/qt_on_cocoa/main.mm
+++ b/tests/manual/cocoa/qt_on_cocoa/main.mm
@@ -43,7 +43,7 @@
#include <QtDeclarative>
#include <QtWidgets/QtWidgets>
-#include <private/qwidgetwindow_qpa_p.h>
+#include <private/qwidgetwindow_p.h>
#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QtGui/QPixmap>
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 9318824e6d..e593756a7d 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -47,7 +47,10 @@ unc
!contains(QT_CONFIG, openssl):!contains(QT_CONFIG, openssl-linked):SUBDIRS -= qssloptions
-contains(QT_CONFIG, opengl):SUBDIRS += qopengltextureblitter
+contains(QT_CONFIG, opengl) {
+ SUBDIRS += qopengltextureblitter
+ contains(QT_CONFIG, egl): SUBDIRS += qopenglcontext
+}
win32 {
SUBDIRS -= network_remote_stresstest network_stresstest
diff --git a/tests/manual/qopenglcontext/main.cpp b/tests/manual/qopenglcontext/main.cpp
new file mode 100644
index 0000000000..dd3178f466
--- /dev/null
+++ b/tests/manual/qopenglcontext/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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 "qopenglcontextwindow.h"
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ QOpenGLContextWindow window;
+ window.resize(300, 300);
+ window.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/qopenglcontext/qopenglcontext.pro b/tests/manual/qopenglcontext/qopenglcontext.pro
new file mode 100644
index 0000000000..c5943809c6
--- /dev/null
+++ b/tests/manual/qopenglcontext/qopenglcontext.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+TARGET = qopenglcontext
+
+QT += gui-private platformsupport-private
+
+HEADERS += $$PWD/qopenglcontextwindow.h
+
+SOURCES += $$PWD/main.cpp \
+ $$PWD/qopenglcontextwindow.cpp
diff --git a/tests/manual/qopenglcontext/qopenglcontextwindow.cpp b/tests/manual/qopenglcontext/qopenglcontextwindow.cpp
new file mode 100644
index 0000000000..bf6fe30c00
--- /dev/null
+++ b/tests/manual/qopenglcontext/qopenglcontextwindow.cpp
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** 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 "qopenglcontextwindow.h"
+#include <QtGui/QOpenGLFunctions>
+#include <QtGui/QOffscreenSurface>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QMatrix4x4>
+#include <qpa/qplatformnativeinterface.h>
+
+#include <QtPlatformSupport/private/qeglconvenience_p.h>
+#include <QtPlatformHeaders/QEGLNativeContext>
+
+QOpenGLContextWindow::QOpenGLContextWindow()
+ : m_blitter(0)
+{
+ setSurfaceType(OpenGLSurface);
+
+ m_context = new QOpenGLContext(this);
+ m_context->setFormat(requestedFormat());
+ m_context->create();
+
+ m_image = QImage(QStringLiteral("qticon64.png")).convertToFormat(QImage::Format_RGBA8888);
+ Q_ASSERT(!m_image.isNull());
+
+ create(); // to make sure format() returns something real
+ createForeignContext();
+}
+
+QOpenGLContextWindow::~QOpenGLContextWindow()
+{
+ if (m_blitter) {
+ m_blitter->destroy(); // the dtor does not call this for some reason
+ delete m_blitter;
+ }
+}
+
+void QOpenGLContextWindow::render()
+{
+ if (!m_context->makeCurrent(this))
+ qFatal("makeCurrent() failed");
+
+ QOpenGLFunctions *f = m_context->functions();
+ f->glViewport(0, 0, dWidth(), dHeight());
+ f->glClearColor(0, 0, 0, 1);
+ f->glClear(GL_COLOR_BUFFER_BIT);
+
+ if (!m_blitter) {
+ m_blitter = new QOpenGLTextureBlitter;
+ m_blitter->create();
+ }
+
+ // Draw the image. If nothing gets shown, then something went wrong with the context
+ // adoption or sharing was not successfully enabled.
+ m_blitter->bind();
+ QRectF r(0, 0, dWidth(), dHeight());
+ QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(QRectF(100, 100, 100, 100), r.toRect());
+ m_blitter->blit(m_textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
+ m_blitter->release();
+
+ m_context->swapBuffers(this);
+}
+
+void QOpenGLContextWindow::exposeEvent(QExposeEvent *)
+{
+ if (isExposed())
+ render();
+}
+
+void QOpenGLContextWindow::createForeignContext()
+{
+ // Here a context will be created manually. This context will share with m_context's
+ // underlying native context. This way the texture, that belongs to the context
+ // created here, will be accessible from m_context too.
+
+ EGLContext shareCtx = m_context->nativeHandle().value<QEGLNativeContext>().context();
+ Q_ASSERT(shareCtx != EGL_NO_CONTEXT);
+
+ EGLDisplay dpy = (EGLDisplay) qGuiApp->platformNativeInterface()->nativeResourceForWindow(
+ QByteArrayLiteral("egldisplay"), this);
+ Q_ASSERT(dpy != EGL_NO_DISPLAY);
+
+ QSurfaceFormat fmt = format();
+ EGLConfig config = q_configFromGLFormat(dpy, fmt);
+
+ QVector<EGLint> contextAttrs;
+ contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
+ contextAttrs.append(fmt.majorVersion());
+ contextAttrs.append(EGL_NONE);
+ switch (fmt.renderableType()) {
+#ifdef EGL_VERSION_1_4
+ case QSurfaceFormat::OpenGL:
+ eglBindAPI(EGL_OPENGL_API);
+ break;
+#endif // EGL_VERSION_1_4
+ default:
+ eglBindAPI(EGL_OPENGL_ES_API);
+ break;
+ }
+
+ EGLContext ctx = eglCreateContext(dpy, config, shareCtx, contextAttrs.constData());
+ Q_ASSERT(ctx != EGL_NO_CONTEXT);
+
+ // Wrap ctx into a QOpenGLContext.
+ QOpenGLContext *ctxWrap = new QOpenGLContext;
+ ctxWrap->setNativeHandle(QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx, dpy)));
+ ctxWrap->setShareContext(m_context); // only needed for correct bookkeeping
+ if (!ctxWrap->create())
+ qFatal("Failed to created wrapping context");
+ Q_ASSERT(ctxWrap->nativeHandle().value<QEGLNativeContext>().context() == ctx);
+
+ QOffscreenSurface surface;
+ surface.setFormat(fmt);
+ surface.create();
+
+ if (!ctxWrap->makeCurrent(&surface))
+ qFatal("Failed to make pbuffer surface current");
+
+ // Create the texture.
+ QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
+ GLuint textureId = 0;
+ f->glGenTextures(1, &textureId);
+ f->glBindTexture(GL_TEXTURE_2D, textureId);
+ f->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ f->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_image.width(), m_image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ m_image.constBits());
+ Q_ASSERT(f->glGetError() == GL_NO_ERROR);
+
+ ctxWrap->doneCurrent();
+ delete ctxWrap; // ctx is not destroyed
+ eglDestroyContext(dpy, ctx); // resources like the texture stay alive until any context on the share list is alive
+ Q_ASSERT(eglGetError() == EGL_SUCCESS);
+
+ m_textureId = textureId;
+}
diff --git a/tests/manual/qopenglcontext/qopenglcontextwindow.h b/tests/manual/qopenglcontext/qopenglcontextwindow.h
new file mode 100644
index 0000000000..6fcb3633bf
--- /dev/null
+++ b/tests/manual/qopenglcontext/qopenglcontextwindow.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QOPENGLCONTEXTWINDOW_H
+#define QOPENGLCONTEXTWINDOW_H
+
+#include <QtGui/QWindow>
+#include <QtGui/QOpenGLContext>
+#include <QtGui/QImage>
+#include <QtCore/QVariant>
+#include <QtGui/private/qopengltextureblitter_p.h>
+
+class QOpenGLContextWindow : public QWindow
+{
+ Q_OBJECT
+
+public:
+ QOpenGLContextWindow();
+ ~QOpenGLContextWindow();
+
+ void render();
+
+protected:
+ void exposeEvent(QExposeEvent *event);
+
+private:
+ qreal dWidth() const { return width() * devicePixelRatio(); }
+ qreal dHeight() const { return height() * devicePixelRatio(); }
+ void createForeignContext();
+
+ QOpenGLContext *m_context;
+ QImage m_image;
+ QVariant m_nativeHandle;
+ uint m_textureId;
+ QOpenGLTextureBlitter *m_blitter;
+};
+
+#endif
diff --git a/tests/manual/qopenglcontext/qticon64.png b/tests/manual/qopenglcontext/qticon64.png
new file mode 100644
index 0000000000..76f02c6c96
--- /dev/null
+++ b/tests/manual/qopenglcontext/qticon64.png
Binary files differ
diff --git a/tests/manual/widgets/itemviews/itemviews.pro b/tests/manual/widgets/itemviews/itemviews.pro
index 6b91531a87..53f658d54d 100644
--- a/tests/manual/widgets/itemviews/itemviews.pro
+++ b/tests/manual/widgets/itemviews/itemviews.pro
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS = delegate qheaderview qtreeview qtreewidget
+SUBDIRS = delegate qheaderview qtreeview qtreewidget tableview-span-navigation
diff --git a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest.pro b/tests/manual/widgets/itemviews/qheaderview/qheaderview.pro
index f83136266d..f83136266d 100644
--- a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest.pro
+++ b/tests/manual/widgets/itemviews/qheaderview/qheaderview.pro
diff --git a/tests/manual/widgets/itemviews/qtreeview/qtreeviewtest.pro b/tests/manual/widgets/itemviews/qtreeview/qtreeview.pro
index c241ee1045..c241ee1045 100644
--- a/tests/manual/widgets/itemviews/qtreeview/qtreeviewtest.pro
+++ b/tests/manual/widgets/itemviews/qtreeview/qtreeview.pro
diff --git a/tests/manual/widgets/itemviews/qtreewidget/qtreewidgettest.pro b/tests/manual/widgets/itemviews/qtreewidget/qtreewidget.pro
index 4b1da9be38..4b1da9be38 100644
--- a/tests/manual/widgets/itemviews/qtreewidget/qtreewidgettest.pro
+++ b/tests/manual/widgets/itemviews/qtreewidget/qtreewidget.pro
diff --git a/tests/manual/widgets/itemviews/tableview-span-navigation/main.cpp b/tests/manual/widgets/itemviews/tableview-span-navigation/main.cpp
new file mode 100644
index 0000000000..8421d0661b
--- /dev/null
+++ b/tests/manual/widgets/itemviews/tableview-span-navigation/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module 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 <QApplication>
+#include <QStandardItemModel>
+#include <QTableView>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QStandardItemModel model(4, 4);
+ QTableView tableView;
+ tableView.setSizeAdjustPolicy(QTableView::AdjustToContents);
+ tableView.setModel(&model);
+
+ for (int row = 0; row < model.rowCount(); ++row) {
+ for (int column = 0; column < model.columnCount(); ++column) {
+ QModelIndex index = model.index(row, column, QModelIndex());
+ model.setData(index, QVariant(QString("%1,%2").arg(row).arg(column)));
+ }
+ }
+
+ tableView.setSpan(1, 1, 2, 2);
+
+ tableView.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/widgets/itemviews/tableview-span-navigation/tableview-span-navigation.pro b/tests/manual/widgets/itemviews/tableview-span-navigation/tableview-span-navigation.pro
new file mode 100644
index 0000000000..ffa006a2d8
--- /dev/null
+++ b/tests/manual/widgets/itemviews/tableview-span-navigation/tableview-span-navigation.pro
@@ -0,0 +1,8 @@
+
+TEMPLATE = app
+TARGET = tableview-span-navigation
+INCLUDEPATH += .
+
+QT += widgets
+
+SOURCES += main.cpp
diff --git a/tests/manual/widgets/kernel/layoutreplace/main.pro b/tests/manual/widgets/kernel/layoutreplace/layoutreplace.pro
index 54c6a4a9fc..54c6a4a9fc 100644
--- a/tests/manual/widgets/kernel/layoutreplace/main.pro
+++ b/tests/manual/widgets/kernel/layoutreplace/layoutreplace.pro
diff --git a/tests/manual/widgets/kernel/qtooltip/main.pro b/tests/manual/widgets/kernel/qtooltip/qtooltip.pro
index dac880a10e..dac880a10e 100644
--- a/tests/manual/widgets/kernel/qtooltip/main.pro
+++ b/tests/manual/widgets/kernel/qtooltip/qtooltip.pro
diff --git a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.pro b/tests/manual/widgets/qgraphicsview/rubberband/rubberband.pro
index 805b0cc119..805b0cc119 100644
--- a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.pro
+++ b/tests/manual/widgets/qgraphicsview/rubberband/rubberband.pro