From 3c4df26a8d184b728395c8aad26b05626176b7b5 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 14:26:49 +1000 Subject: Use console.log, not print. --- tests/auto/declarative/qmldebug/tst_qmldebug.cpp | 2 +- tests/auto/declarative/qmlecmascript/data/scriptErrors.qml | 2 +- tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 2 +- tests/auto/declarative/qmlgraphicslistview/data/listview.qml | 12 ++++++------ .../auto/declarative/qmlgraphicspathview/data/datamodel.qml | 2 +- tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml | 2 +- tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml | 2 +- tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp | 4 ++-- tests/auto/declarative/qmllanguage/data/OnCompletedType.qml | 2 +- .../qmllanguage/data/customParserIdNotAllowed.errors.txt | 2 +- tests/auto/declarative/qmllanguage/data/defaultGrouped.qml | 2 +- tests/auto/declarative/qmllanguage/data/doubleSignal.qml | 4 ++-- .../declarative/qmllanguage/data/dynamicSignalsAndSlots.qml | 2 +- .../qmllanguage/data/invalidGroupedProperty.7.qml | 2 +- tests/auto/declarative/qmllanguage/data/missingSignal.qml | 2 +- tests/auto/declarative/qmllanguage/data/onCompleted.qml | 4 ++-- tests/auto/declarative/qmllanguage/data/scriptString.qml | 2 +- tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp | 4 +++- .../auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp | 4 ++-- tests/auto/declarative/qmlqt/data/consoleLog.qml | 8 ++++++++ tests/auto/declarative/qmlqt/tst_qmlqt.cpp | 11 +++++++++++ tests/auto/declarative/valuetypes/data/deletedObject.js | 4 ++-- tests/auto/declarative/visual/focusscope/test.qml | 10 +++++----- tests/auto/declarative/visual/focusscope/test3.qml | 4 ++-- tests/auto/declarative/visual/webview/zooming/zooming.qml | 4 ++-- 25 files changed, 60 insertions(+), 39 deletions(-) create mode 100644 tests/auto/declarative/qmlqt/data/consoleLog.qml diff --git a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp index 6916cc9..785d55f 100644 --- a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp +++ b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp @@ -816,7 +816,7 @@ int main(int argc, char *argv[]) "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" "Text { color: blueRect.color; }" "MouseRegion {" - "onEntered: { print('hello') }" + "onEntered: { console.log('hello') }" "}" "}"; // add second component to test multiple root contexts diff --git a/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml b/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml index ff22990..9d99b41 100644 --- a/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml +++ b/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml @@ -9,7 +9,7 @@ MyQmlObject { property int x: undefinedObject property int y: (a.value, undefinedObject) - onBasicSignal: { print(a.value); } + onBasicSignal: { console.log(a.value); } } diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 983ddd0..fe3ae6b 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -218,7 +218,7 @@ void tst_qmlecmascript::basicExpressions_data() QTest::addColumn("result"); QTest::addColumn("nest"); - QTest::newRow("Syntax error (self test)") << "{print({'a':1'}.a)}" << QVariant() << false; + QTest::newRow("Syntax error (self test)") << "{console.log({'a':1'}.a)}" << QVariant() << false; QTest::newRow("Context property") << "a" << QVariant(1944) << false; QTest::newRow("Context property") << "a" << QVariant(1944) << true; QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << false; diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml index b64b399..99b3db6 100644 --- a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml +++ b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml @@ -7,23 +7,23 @@ Rectangle { function checkProperties() { testObject.error = false; if (list.model != testModel) { - print("model property incorrect"); + console.log("model property incorrect"); testObject.error = true; } if (!testObject.animate && list.delegate != myDelegate) { - print("delegate property incorrect - expected myDelegate"); + console.log("delegate property incorrect - expected myDelegate"); testObject.error = true; } if (testObject.animate && list.delegate != animatedDelegate) { - print("delegate property incorrect - expected animatedDelegate"); + console.log("delegate property incorrect - expected animatedDelegate"); testObject.error = true; } if (testObject.invalidHighlight && list.highlight != invalidHl) { - print("highlight property incorrect - expected invalidHl"); + console.log("highlight property incorrect - expected invalidHl"); testObject.error = true; } if (!testObject.invalidHighlight && list.highlight != myHighlight) { - print("highlight property incorrect - expected myHighlight"); + console.log("highlight property incorrect - expected myHighlight"); testObject.error = true; } } @@ -85,7 +85,7 @@ Rectangle { } color: ListView.isCurrentItem ? "lightsteelblue" : "white" ListView.onRemove: SequentialAnimation { - ScriptAction { script: print("Fix PropertyAction with attached properties") } + ScriptAction { script: console.log("Fix PropertyAction with attached properties") } /* PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true } NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } diff --git a/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml b/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml index 6aea96b..9d08e5d 100644 --- a/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml +++ b/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml @@ -9,7 +9,7 @@ PathView { function checkProperties() { testObject.error = false; if (testObject.useModel && view.model != itemModel) { - print("model property incorrect"); + console.log("model property incorrect"); testObject.error = true; } } diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml b/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml index 2d6eae8..cf1fb4d 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml +++ b/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml @@ -10,7 +10,7 @@ Rectangle { function checkProperties() { testObject.error = false; if (repeater.delegate != comp) { - print("delegate property incorrect"); + console.log("delegate property incorrect"); testObject.error = true; } } diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml b/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml index 8d28bf8..fc6b34c 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml +++ b/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml @@ -11,7 +11,7 @@ Rectangle { function checkProperties() { testObject.error = false; if (testObject.useModel && view.model != itemModel) { - print("model property incorrect"); + console.log("model property incorrect"); testObject.error = true; } } diff --git a/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp b/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp index f493e0e..1173f85 100644 --- a/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp +++ b/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp @@ -316,7 +316,7 @@ void tst_qmlinstruction::dump() } { - data->primitives << "print(1921)"; + data->primitives << "console.log(1921)"; QmlInstruction i; i.line = 27; @@ -564,7 +564,7 @@ void tst_qmlinstruction::dump() << "24\t\t24\tSTORE_OBJECT\t\t21" << "25\t\t25\tSTORE_VARIANT_OBJECT\t22" << "26\t\t26\tSTORE_INTERFACE\t\t23" - << "27\t\t27\tSTORE_SIGNAL\t\t2\t4\t\t\"print(1921)\"" + << "27\t\t27\tSTORE_SIGNAL\t\t2\t4\t\t\"console.log(1921)\"" << "28\t\t28\tSTORE_SCRIPT\t\t2\t18\t28" << "29\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1" << "30\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\"" diff --git a/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml b/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml index cdba495..2889caf 100644 --- a/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml +++ b/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml @@ -4,5 +4,5 @@ import Qt 4.6 MyQmlObject { property int a: Math.max(10, 9) property int b: 11 - Component.onCompleted: print("Completed " + a + " " + b); + Component.onCompleted: console.log("Completed " + a + " " + b); } diff --git a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt b/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt index d28c0bd..43a8bb2 100644 --- a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt +++ b/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt @@ -1 +1 @@ -4:19:Cannot use reserved "id" property in ListModel +4:19:ListElement: cannot use reserved "id" property diff --git a/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml b/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml index 532b2bb..0fd1404 100644 --- a/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml +++ b/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml @@ -3,7 +3,7 @@ import Qt 4.6 MyTypeObject { grouped { - script: print(1921) + script: console.log(1921) QtObject {} } } diff --git a/tests/auto/declarative/qmllanguage/data/doubleSignal.qml b/tests/auto/declarative/qmllanguage/data/doubleSignal.qml index ec813c9..fb07b9f 100644 --- a/tests/auto/declarative/qmllanguage/data/doubleSignal.qml +++ b/tests/auto/declarative/qmllanguage/data/doubleSignal.qml @@ -1,7 +1,7 @@ import Test 1.0 MyQmlObject { - onBasicSignal: print(1921) - onBasicSignal: print(1921) + onBasicSignal: console.log(1921) + onBasicSignal: console.log(1921) } diff --git a/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml b/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml index 737681e..2a834e8 100644 --- a/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml +++ b/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml @@ -6,5 +6,5 @@ QtObject { function slot2() {} property int test: 0 - function slot3(a) { print(1921); test = a; } + function slot3(a) { console.log(1921); test = a; } } diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml index b77fb90..977539a 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml +++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml @@ -1,5 +1,5 @@ import Test 1.0 MyTypeObject { - nullGrouped.script: print(1921) + nullGrouped.script: console.log(1921) } diff --git a/tests/auto/declarative/qmllanguage/data/missingSignal.qml b/tests/auto/declarative/qmllanguage/data/missingSignal.qml index 8a87437..3bf75f6 100644 --- a/tests/auto/declarative/qmllanguage/data/missingSignal.qml +++ b/tests/auto/declarative/qmllanguage/data/missingSignal.qml @@ -1,5 +1,5 @@ import Test 1.0 import Qt 4.6 QtObject { - onClicked: print("Hello world!") + onClicked: console.log("Hello world!") } diff --git a/tests/auto/declarative/qmllanguage/data/onCompleted.qml b/tests/auto/declarative/qmllanguage/data/onCompleted.qml index ae47d4b..5725f85 100644 --- a/tests/auto/declarative/qmllanguage/data/onCompleted.qml +++ b/tests/auto/declarative/qmllanguage/data/onCompleted.qml @@ -5,13 +5,13 @@ MyTypeObject { // We set a and b to ensure that onCompleted is executed after bindings and // constants have been assigned property int a: Math.min(6, 7) - Component.onCompleted: print("Completed " + a + " " + nestedObject.b) + Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b) objectProperty: OnCompletedType { qmlobjectProperty: MyQmlObject { id: nestedObject property int b: 10 - Component.onCompleted: print("Completed " + a + " " + nestedObject.b) + Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b) } } } diff --git a/tests/auto/declarative/qmllanguage/data/scriptString.qml b/tests/auto/declarative/qmllanguage/data/scriptString.qml index 51e6e48..40a3bbe 100644 --- a/tests/auto/declarative/qmllanguage/data/scriptString.qml +++ b/tests/auto/declarative/qmllanguage/data/scriptString.qml @@ -2,5 +2,5 @@ import Test 1.0 MyTypeObject { scriptProperty: foo + bar - grouped.script: print(1921) + grouped.script: console.log(1921) } diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 892d2eb..685beaf 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -606,6 +606,8 @@ void tst_qmllanguage::dynamicObjectProperties() // Tests the declaration of dynamic signals and slots void tst_qmllanguage::dynamicSignalsAndSlots() { + QTest::ignoreMessage(QtDebugMsg, "1921"); + QmlComponent component(&engine, TEST_FILE("dynamicSignalsAndSlots.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); @@ -956,7 +958,7 @@ void tst_qmllanguage::scriptString() QCOMPARE(object->scriptProperty().context(), qmlContext(object)); QVERIFY(object->grouped() != 0); - QCOMPARE(object->grouped()->script().script(), QString("print(1921)")); + QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)")); QCOMPARE(object->grouped()->script().scopeObject(), object); QCOMPARE(object->grouped()->script().context(), qmlContext(object)); } diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp index d6e88b5..8dcfc11 100644 --- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp @@ -854,12 +854,12 @@ void tst_qmlmetaproperty::write() { PropertyObject o; QmlMetaProperty p(&o, "onClicked"); - QCOMPARE(p.write(QVariant("print(1921)")), false); + QCOMPARE(p.write(QVariant("console.log(1921)")), false); QVERIFY(0 == p.setSignalExpression(new QmlExpression())); QVERIFY(0 != p.signalExpression()); - QCOMPARE(p.write(QVariant("print(1921)")), false); + QCOMPARE(p.write(QVariant("console.log(1921)")), false); QVERIFY(0 != p.signalExpression()); } diff --git a/tests/auto/declarative/qmlqt/data/consoleLog.qml b/tests/auto/declarative/qmlqt/data/consoleLog.qml new file mode 100644 index 0000000..e657ff1 --- /dev/null +++ b/tests/auto/declarative/qmlqt/data/consoleLog.qml @@ -0,0 +1,8 @@ +import Qt 4.6 + +QtObject { + Component.onCompleted: { + console.log("completed", "ok") + console.log("completed ok") + } +} diff --git a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp index 292102a..21c5478 100644 --- a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp +++ b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp @@ -72,6 +72,7 @@ private slots: void md5(); void createComponent(); void createQmlObject(); + void consoleLog(); private: QmlEngine engine; @@ -353,6 +354,16 @@ void tst_qmlqt::createQmlObject() delete object; } +void tst_qmlqt::consoleLog() +{ + QTest::ignoreMessage(QtDebugMsg, "completed ok"); + QTest::ignoreMessage(QtDebugMsg, "completed ok"); + QmlComponent component(&engine, TEST_FILE("consoleLog.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + QTEST_MAIN(tst_qmlqt) #include "tst_qmlqt.moc" diff --git a/tests/auto/declarative/valuetypes/data/deletedObject.js b/tests/auto/declarative/valuetypes/data/deletedObject.js index f554a0f..af298ff 100644 --- a/tests/auto/declarative/valuetypes/data/deletedObject.js +++ b/tests/auto/declarative/valuetypes/data/deletedObject.js @@ -3,11 +3,11 @@ var savedReference; function startup() { savedReference = object.rect; - print("Test: " + savedReference.x); + console.log("Test: " + savedReference.x); } function afterDelete() { - print("Test: " + savedReference.x); + console.log("Test: " + savedReference.x); } diff --git a/tests/auto/declarative/visual/focusscope/test.qml b/tests/auto/declarative/visual/focusscope/test.qml index 77ffb84..dd6d726 100644 --- a/tests/auto/declarative/visual/focusscope/test.qml +++ b/tests/auto/declarative/visual/focusscope/test.qml @@ -5,13 +5,13 @@ Rectangle { width: 800 height: 600 - Keys.onDigit9Pressed: print("Error - Root") + Keys.onDigit9Pressed: console.log("Error - Root") FocusScope { id: MyScope focus: true - Keys.onDigit9Pressed: print("Error - FocusScope") + Keys.onDigit9Pressed: console.log("Error - FocusScope") Rectangle { height: 120 @@ -27,7 +27,7 @@ Rectangle { width: 100; height: 100; color: "green" border.width: 5 border.color: wantsFocus?"blue":"black" - Keys.onDigit9Pressed: print("Top Left"); + Keys.onDigit9Pressed: console.log("Top Left"); KeyNavigation.right: Item2 focus: true @@ -44,7 +44,7 @@ Rectangle { border.width: 5 border.color: wantsFocus?"blue":"black" KeyNavigation.left: Item1 - Keys.onDigit9Pressed: print("Top Right"); + Keys.onDigit9Pressed: console.log("Top Right"); Rectangle { width: 50; height: 50; anchors.centerIn: parent @@ -64,7 +64,7 @@ Rectangle { border.width: 5 border.color: wantsFocus?"blue":"black" - Keys.onDigit9Pressed: print("Bottom Left"); + Keys.onDigit9Pressed: console.log("Bottom Left"); KeyNavigation.up: MyScope Rectangle { diff --git a/tests/auto/declarative/visual/focusscope/test3.qml b/tests/auto/declarative/visual/focusscope/test3.qml index b5feeb5..4be9dc7 100644 --- a/tests/auto/declarative/visual/focusscope/test3.qml +++ b/tests/auto/declarative/visual/focusscope/test3.qml @@ -23,10 +23,10 @@ Rectangle { FocusScope { id: Root width: 50; height: 50; - Keys.onDigit9Pressed: print("Error - " + name) + Keys.onDigit9Pressed: console.log("Error - " + name) Rectangle { focus: true - Keys.onDigit9Pressed: print(name) + Keys.onDigit9Pressed: console.log(name) width: 50; height: 50; color: Root.ListView.isCurrentItem?"red":"green" Text { text: name; anchors.centerIn: parent } diff --git a/tests/auto/declarative/visual/webview/zooming/zooming.qml b/tests/auto/declarative/visual/webview/zooming/zooming.qml index 3ac57f6..0ea9131 100644 --- a/tests/auto/declarative/visual/webview/zooming/zooming.qml +++ b/tests/auto/declarative/visual/webview/zooming/zooming.qml @@ -12,6 +12,6 @@ WebView { url: "zooming.html" preferredWidth: width preferredHeight: height - onDoubleClick: {print(clickX,clickY);heuristicZoom(clickX,clickY,2)} - onZoomTo: {print(zoom);scale=zoom;x=width/2-centerX;y=height/2-centerY} + onDoubleClick: {console.log(clickX,clickY);heuristicZoom(clickX,clickY,2)} + onZoomTo: {console.log(zoom);scale=zoom;x=width/2-centerX;y=height/2-centerY} } -- cgit v0.12