From 8c80dd6a9893c6e323ae69b651efd7b629b2714c Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 25 Jul 2014 18:29:19 +0200 Subject: QDeclarativeError::toString: improve handling of empty urls. "file::2:23: ..." is strange to read. Show ":2:23: ..." instead, by treating empty urls (including "file:") as unknown, and by still showing line and column numbers in such a case. This change makes it possible for QUrl::fromLocalFile("") to return an empty url rather than "file:", which this module was relying upon in the tests. Change-Id: Id6d8aaa73673283cb65cbd1316dca77f859a3f8f Reviewed-by: Friedemann Kleint --- .../tst_qdeclarativeanchors.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp') diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 7869ffc4..7d2f123d 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -414,55 +414,55 @@ void tst_qdeclarativeanchors::illegalSets_data() QTest::newRow("H - too many anchors") << "Rectangle { id: rect; Rectangle { anchors.left: rect.left; anchors.right: rect.right; anchors.horizontalCenter: rect.horizontalCenter } }" - << "file::2:23: QML Rectangle: Cannot specify left, right, and hcenter anchors."; + << ":2:23: QML Rectangle: Cannot specify left, right, and hcenter anchors."; foreach (const QString &side, QStringList() << "left" << "right") { QTest::newRow("H - anchor to V") << QString("Rectangle { Rectangle { anchors.%1: parent.top } }").arg(side) - << "file::2:13: QML Rectangle: Cannot anchor a horizontal edge to a vertical edge."; + << ":2:13: QML Rectangle: Cannot anchor a horizontal edge to a vertical edge."; QTest::newRow("H - anchor to non parent/sibling") << QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side) - << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling."; + << ":2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling."; QTest::newRow("H - anchor to self") << QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side) - << "file::2:1: QML Rectangle: Cannot anchor item to self."; + << ":2:1: QML Rectangle: Cannot anchor item to self."; } QTest::newRow("V - too many anchors") << "Rectangle { id: rect; Rectangle { anchors.top: rect.top; anchors.bottom: rect.bottom; anchors.verticalCenter: rect.verticalCenter } }" - << "file::2:23: QML Rectangle: Cannot specify top, bottom, and vcenter anchors."; + << ":2:23: QML Rectangle: Cannot specify top, bottom, and vcenter anchors."; QTest::newRow("V - too many anchors with baseline") << "Rectangle { Text { id: text1; text: \"Hello\" } Text { anchors.baseline: text1.baseline; anchors.top: text1.top; } }" - << "file::2:47: QML Text: Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors."; + << ":2:47: QML Text: Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors."; foreach (const QString &side, QStringList() << "top" << "bottom" << "baseline") { QTest::newRow("V - anchor to H") << QString("Rectangle { Rectangle { anchors.%1: parent.left } }").arg(side) - << "file::2:13: QML Rectangle: Cannot anchor a vertical edge to a horizontal edge."; + << ":2:13: QML Rectangle: Cannot anchor a vertical edge to a horizontal edge."; QTest::newRow("V - anchor to non parent/sibling") << QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side) - << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling."; + << ":2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling."; QTest::newRow("V - anchor to self") << QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side) - << "file::2:1: QML Rectangle: Cannot anchor item to self."; + << ":2:1: QML Rectangle: Cannot anchor item to self."; } QTest::newRow("centerIn - anchor to non parent/sibling") << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.centerIn: rect} }" - << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling."; + << ":2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling."; QTest::newRow("fill - anchor to non parent/sibling") << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.fill: rect} }" - << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling."; + << ":2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling."; } void tst_qdeclarativeanchors::reset() -- cgit v1.2.3