Merge remote-tracking branch 'origin/5.6' into 5.7

Conflicts:
	src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp
	src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h

Change-Id: I1e6a9424e7f87d9e4ac1ea387ec70e151106f1c7
This commit is contained in:
Liang Qi 2016-08-05 09:02:17 +02:00
commit 45f79dc7e5
9 changed files with 71 additions and 37 deletions

View File

@ -5,8 +5,7 @@ SUBDIRS = samegame \
tweetsearch \
maroon \
photosurface \
photoviewer \
stocqt
qtHaveModule(xmlpatterns): SUBDIRS += rssnews
qtHaveModule(xmlpatterns): SUBDIRS += rssnews photoviewer

View File

@ -110,7 +110,7 @@ console.log("Result: " + a);
\endcode
Any attempt to modify the global object - either implicitly or explicitly - will
cause an exception. If uncaught, this will result in an warning being printed,
cause an exception. If uncaught, this will result in a warning being printed,
that includes the file and line number of the offending code.
\li Global code is run in a reduced scope.
@ -120,7 +120,7 @@ code, it is executed in a scope that contains only the external file itself and
the global object. That is, it will not have access to the QML objects and
properties it \l {Scope and Naming Resolution}{normally would}.
Global code that only accesses script local variable is permitted. This is an
Global code that only accesses script local variables is permitted. This is an
example of valid global code.
\code

View File

@ -48,6 +48,7 @@
#include <QTime>
#include <QMap>
#include <QScopedValueRollback>
#include <iostream>
#include <cstdlib>
@ -548,6 +549,8 @@ void MemoryManager::runGC()
return;
}
QScopedValueRollback<bool> gcBlocker(m_d->gcBlocked, true);
if (!m_d->gcStats) {
mark();
sweep();

View File

@ -62,6 +62,7 @@
#include <private/qv4objectiterator_p.h>
#include <private/qv4qobjectwrapper_p.h>
#include <QDir>
#include <QStack>
#include <QStringList>
#include <QThreadStorage>
@ -550,7 +551,8 @@ QQmlComponent::QQmlComponent(QQmlEngine *engine, const QString &fileName,
{
Q_D(QQmlComponent);
d->engine = engine;
d->loadUrl(d->engine->baseUrl().resolved(QUrl::fromLocalFile(fileName)));
const QUrl url = QDir::isAbsolutePath(fileName) ? QUrl::fromLocalFile(fileName) : d->engine->baseUrl().resolved(QUrl(fileName));
d->loadUrl(url);
}
/*!
@ -566,7 +568,8 @@ QQmlComponent::QQmlComponent(QQmlEngine *engine, const QString &fileName,
{
Q_D(QQmlComponent);
d->engine = engine;
d->loadUrl(d->engine->baseUrl().resolved(QUrl::fromLocalFile(fileName)), mode);
const QUrl url = QDir::isAbsolutePath(fileName) ? QUrl::fromLocalFile(fileName) : d->engine->baseUrl().resolved(QUrl(fileName));
d->loadUrl(url, mode);
}
/*!

View File

@ -7420,8 +7420,11 @@ void tst_qqmlecmascript::negativeYear()
QVariant q;
QMetaObject::invokeMethod(object, "check_negative_tostring", Q_RETURN_ARG(QVariant, q));
// Strip the timezone. It should be irrelevant as the date was created with the same one.
QCOMPARE(q.toString().left(32), QStringLiteral("result: Sat Jan 1 00:00:00 -2001"));
// Only check for the year. We hope that every language writes the year in arabic numerals and
// in relation to a specific dude's date of birth. We also hope that no language adds a "-2001"
// junk string somewhere in the middle.
QVERIFY(q.toString().indexOf(QStringLiteral("-2001")) != -1);
QMetaObject::invokeMethod(object, "check_negative_toisostring", Q_RETURN_ARG(QVariant, q));
QCOMPARE(q.toString().left(16), QStringLiteral("result: -002000-"));

View File

@ -180,7 +180,7 @@ void tst_QQuickFramebufferObject::testThatStuffWorks()
qmlRegisterType<FBOItem>("FBOItem", 1, 0, "FBOItem");
QQuickView view;
view.setSource(QUrl::fromLocalFile("data/testStuff.qml"));
view.setSource(testFileUrl("testStuff.qml"));
FBOItem *item = view.rootObject()->findChild<FBOItem *>("fbo");
@ -224,7 +224,7 @@ void tst_QQuickFramebufferObject::testInvalidate()
qmlRegisterType<FBOItem>("FBOItem", 1, 0, "FBOItem");
QQuickView view;
view.setSource(QUrl::fromLocalFile("data/testStuff.qml"));
view.setSource(testFileUrl("testStuff.qml"));
FBOItem *item = view.rootObject()->findChild<FBOItem *>("fbo");
item->setTextureFollowsItemSize(false);

View File

@ -250,6 +250,7 @@ private slots:
void QTBUG_50105();
void keyNavigationEnabled();
void QTBUG_50097_stickyHeader_positionViewAtIndex();
void itemFiltered();
private:
template <class T> void items(const QUrl &source);
@ -8343,6 +8344,37 @@ void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex()
QTRY_COMPARE(listview->contentY(), -100.0); // back to the same position: header visible, items not under the header.
}
void tst_QQuickListView::itemFiltered()
{
QStringListModel model(QStringList() << "one" << "two" << "three" << "four" << "five" << "six");
QSortFilterProxyModel proxy1;
proxy1.setSourceModel(&model);
proxy1.setSortRole(Qt::DisplayRole);
proxy1.setDynamicSortFilter(true);
proxy1.sort(0);
QSortFilterProxyModel proxy2;
proxy2.setSourceModel(&proxy1);
proxy2.setFilterRole(Qt::DisplayRole);
proxy2.setFilterRegExp("^[^ ]*$");
proxy2.setDynamicSortFilter(true);
QScopedPointer<QQuickView> window(createView());
window->engine()->rootContext()->setContextProperty("_model", &proxy2);
QQmlComponent component(window->engine());
component.setData("import QtQuick 2.4; ListView { "
"anchors.fill: parent; model: _model; delegate: Text { width: parent.width;"
"text: model.display; } }",
QUrl());
window->setContent(QUrl(), &component, component.create());
window->show();
QTest::qWaitForWindowExposed(window.data());
// this should not crash
model.setData(model.index(2), QStringLiteral("modified three"), Qt::DisplayRole);
}
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"

View File

@ -48,7 +48,7 @@ private slots:
void tst_QQuickOpenGLInfo::testProperties()
{
QQuickView view;
view.setSource(QUrl::fromLocalFile("data/basic.qml"));
view.setSource(testFileUrl("basic.qml"));
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));

View File

@ -39,6 +39,7 @@
#include <private/qsgcontext_p.h>
#include <private/qsgrenderloop_p.h>
#include "../../shared/util.h"
class PerPixelRect : public QQuickItem
{
@ -84,7 +85,7 @@ private:
QColor m_color;
};
class tst_SceneGraph : public QObject
class tst_SceneGraph : public QQmlDataTest
{
Q_OBJECT
@ -104,6 +105,7 @@ private slots:
private:
bool m_brokenMipmapSupport;
QQuickView *createView(const QString &file, QWindow *parent = 0, int x = -1, int y = -1, int w = -1, int h = -1);
};
template <typename T> class ScopedList : public QList<T> {
@ -115,6 +117,8 @@ void tst_SceneGraph::initTestCase()
{
qmlRegisterType<PerPixelRect>("SceneGraphTest", 1, 0, "PerPixelRect");
QQmlDataTest::initTestCase();
QSGRenderLoop *loop = QSGRenderLoop::instance();
qDebug() << "RenderLoop: " << loop;
@ -152,26 +156,16 @@ void tst_SceneGraph::initTestCase()
context.doneCurrent();
}
QQuickView *createView(const QString &file, QWindow *parent = 0, int x = -1, int y = -1, int w = -1, int h = -1)
QQuickView *tst_SceneGraph::createView(const QString &file, QWindow *parent, int x, int y, int w, int h)
{
QQuickView *view = new QQuickView(parent);
view->setSource(QUrl::fromLocalFile("data/" + file));
view->setSource(testFileUrl(file));
if (x >= 0 && y >= 0) view->setPosition(x, y);
if (w >= 0 && h >= 0) view->resize(w, h);
view->show();
return view;
}
QImage showAndGrab(const QString &file, int w, int h)
{
QQuickView view;
view.setSource(QUrl::fromLocalFile(QStringLiteral("data/") + file));
if (w >= 0 && h >= 0)
view.resize(w, h);
view.create();
return view.grabWindow();
}
// Assumes the images are opaque white...
bool containsSomethingOtherThanWhite(const QImage &image)
{
@ -405,17 +399,17 @@ void tst_SceneGraph::render_data()
QTest::addColumn<QList<Sample> >("finalStage");
QList<QString> files;
files << "data/render_DrawSets.qml"
<< "data/render_Overlap.qml"
<< "data/render_MovingOverlap.qml"
<< "data/render_BreakOpacityBatch.qml"
<< "data/render_OutOfFloatRange.qml"
<< "data/render_StackingOrder.qml"
<< "data/render_ImageFiltering.qml"
<< "data/render_bug37422.qml"
<< "data/render_OpacityThroughBatchRoot.qml";
files << "render_DrawSets.qml"
<< "render_Overlap.qml"
<< "render_MovingOverlap.qml"
<< "render_BreakOpacityBatch.qml"
<< "render_OutOfFloatRange.qml"
<< "render_StackingOrder.qml"
<< "render_ImageFiltering.qml"
<< "render_bug37422.qml"
<< "render_OpacityThroughBatchRoot.qml";
if (!m_brokenMipmapSupport)
files << "data/render_Mipmap.qml";
files << "render_Mipmap.qml";
QRegExp sampleCount("#samples: *(\\d+)");
// X:int Y:int R:float G:float B:float Error:float
@ -423,7 +417,7 @@ void tst_SceneGraph::render_data()
QRegExp finalSamples("#final: *(\\d+) *(\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+) *(\\d\\.\\d+)");
foreach (QString fileName, files) {
QFile file(fileName);
QFile file(testFile(fileName));
if (!file.open(QFile::ReadOnly)) {
qFatal("render_data: QFile::open failed! file=%s, error=%s",
qPrintable(fileName), qPrintable(file.errorString()));
@ -466,7 +460,7 @@ void tst_SceneGraph::render()
QQuickView view;
view.rootContext()->setContextProperty("suite", &suite);
view.setSource(QUrl::fromLocalFile(file));
view.setSource(testFileUrl(file));
view.setResizeMode(QQuickView::SizeViewToRootObject);
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
@ -514,7 +508,7 @@ void tst_SceneGraph::hideWithOtherContext()
{
QQuickView view;
view.setSource(QUrl::fromLocalFile("data/simple.qml"));
view.setSource(testFileUrl("simple.qml"));
view.setResizeMode(QQuickView::SizeViewToRootObject);
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));