Source

Target

Showing with 28 additions and 5 deletions
...@@ -260,6 +260,8 @@ QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::text ...@@ -260,6 +260,8 @@ QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::text
By default, the node does not take ownership of the texture. By default, the node does not take ownership of the texture.
\sa setTexture() \sa setTexture()
\since 5.4
*/ */
void QSGSimpleTextureNode::setOwnsTexture(bool owns) void QSGSimpleTextureNode::setOwnsTexture(bool owns)
{ {
...@@ -269,6 +271,8 @@ void QSGSimpleTextureNode::setOwnsTexture(bool owns) ...@@ -269,6 +271,8 @@ void QSGSimpleTextureNode::setOwnsTexture(bool owns)
/*! /*!
Returns \c true if the node takes ownership of the texture; otherwise returns \c false. Returns \c true if the node takes ownership of the texture; otherwise returns \c false.
\since 5.4
*/ */
bool QSGSimpleTextureNode::ownsTexture() const bool QSGSimpleTextureNode::ownsTexture() const
{ {
......
...@@ -91,12 +91,17 @@ private slots: ...@@ -91,12 +91,17 @@ private slots:
void stopAtBounds_data(); void stopAtBounds_data();
void nestedMouseAreaUsingTouch(); void nestedMouseAreaUsingTouch();
void pressDelayWithLoader(); void pressDelayWithLoader();
void cleanup();
private: private:
void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to); void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
QQmlEngine engine;
}; };
void tst_qquickflickable::cleanup()
{
QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
}
void tst_qquickflickable::create() void tst_qquickflickable::create()
{ {
QQmlEngine engine; QQmlEngine engine;
...@@ -199,6 +204,7 @@ void tst_qquickflickable::properties() ...@@ -199,6 +204,7 @@ void tst_qquickflickable::properties()
void tst_qquickflickable::boundsBehavior() void tst_qquickflickable::boundsBehavior()
{ {
QQmlEngine engine;
QQmlComponent component(&engine); QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Flickable { boundsBehavior: Flickable.StopAtBounds }", QUrl::fromLocalFile("")); component.setData("import QtQuick 2.0; Flickable { boundsBehavior: Flickable.StopAtBounds }", QUrl::fromLocalFile(""));
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create()); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
...@@ -330,6 +336,7 @@ void tst_qquickflickable::rebound() ...@@ -330,6 +336,7 @@ void tst_qquickflickable::rebound()
void tst_qquickflickable::maximumFlickVelocity() void tst_qquickflickable::maximumFlickVelocity()
{ {
QQmlEngine engine;
QQmlComponent component(&engine); QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); component.setData("import QtQuick 2.0; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile(""));
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create()); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
...@@ -349,6 +356,7 @@ void tst_qquickflickable::maximumFlickVelocity() ...@@ -349,6 +356,7 @@ void tst_qquickflickable::maximumFlickVelocity()
void tst_qquickflickable::flickDeceleration() void tst_qquickflickable::flickDeceleration()
{ {
QQmlEngine engine;
QQmlComponent component(&engine); QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); component.setData("import QtQuick 2.0; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile(""));
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create()); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
...@@ -553,6 +561,7 @@ void tst_qquickflickable::nestedClickThenFlick() ...@@ -553,6 +561,7 @@ void tst_qquickflickable::nestedClickThenFlick()
void tst_qquickflickable::flickableDirection() void tst_qquickflickable::flickableDirection()
{ {
QQmlEngine engine;
QQmlComponent component(&engine); QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile("")); component.setData("import QtQuick 2.0; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile(""));
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create()); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
...@@ -1213,9 +1222,16 @@ void tst_qquickflickable::flickVelocity() ...@@ -1213,9 +1222,16 @@ void tst_qquickflickable::flickVelocity()
void tst_qquickflickable::margins() void tst_qquickflickable::margins()
{ {
QQmlEngine engine; QScopedPointer<QQuickView> window(new QQuickView);
QQmlComponent c(&engine, testFileUrl("margins.qml")); window->setSource(testFileUrl("margins.qml"));
QQuickItem *root = qobject_cast<QQuickItem*>(c.create()); QTRY_COMPARE(window->status(), QQuickView::Ready);
QQuickViewTestUtil::centerOnScreen(window.data());
QQuickViewTestUtil::moveMouseAway(window.data());
window->setTitle(QTest::currentTestFunction());
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickItem *root = window->rootObject();
QVERIFY(root);
QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root);
QVERIFY(obj != 0); QVERIFY(obj != 0);
......
...@@ -494,6 +494,7 @@ int main(int argc, char *argv[]) ...@@ -494,6 +494,7 @@ int main(int argc, char *argv[])
foreach (const QString &path, files) { foreach (const QString &path, files) {
//QUrl::fromUserInput doesn't treat no scheme as relative file paths //QUrl::fromUserInput doesn't treat no scheme as relative file paths
#ifndef QT_NO_REGULAREXPRESSION
QRegularExpression urlRe("[[:word:]]+://.*"); QRegularExpression urlRe("[[:word:]]+://.*");
if (urlRe.match(path).hasMatch()) { //Treat as a URL if (urlRe.match(path).hasMatch()) { //Treat as a URL
QUrl url = QUrl::fromUserInput(path); QUrl url = QUrl::fromUserInput(path);
...@@ -503,7 +504,9 @@ int main(int argc, char *argv[]) ...@@ -503,7 +504,9 @@ int main(int argc, char *argv[])
? QDir::toNativeSeparators(url.toLocalFile()) ? QDir::toNativeSeparators(url.toLocalFile())
: url.toString())); : url.toString()));
e.load(url); e.load(url);
} else { //Local file path } else
#endif
{ //Local file path
if (verboseMode) if (verboseMode)
printf("qml: loading %s\n", qPrintable(QDir::toNativeSeparators(path))); printf("qml: loading %s\n", qPrintable(QDir::toNativeSeparators(path)));
......