Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit ensures that the String.arg() function works correctly, by registering an anonymous function with the String Prototype object which calls the StringArg function, ensuring that the "this" object is valid (and passing the string as an argument to StringArg instead). Change-Id: I0a8cbaa12b39beb03a237c3ab62c6e21fafdedbf Reviewed-on: http://codereview.qt-project.org/4385 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
- Loading branch information
Chris Adams
authored and
Qt by Nokia
committed
Sep 28, 2011
1 parent
b081df4
commit 8dd9edd
Showing
4 changed files
with
92 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
tests/auto/declarative/qdeclarativeecmascript/data/stringArg.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import QtQuick 2.0 | ||
|
||
Item { | ||
id: root | ||
property bool returnValue: false | ||
|
||
property string first | ||
property string second | ||
property string third | ||
property string fourth | ||
property string fifth | ||
property string sixth | ||
property string seventh | ||
property string eighth | ||
property string ninth | ||
|
||
function success() { | ||
var a = "Value is %1"; | ||
for (var ii = 0; ii < 10; ++ii) { | ||
first = a.arg("string"); | ||
second = a.arg(1); | ||
third = a.arg(true); | ||
fourth = a.arg(3.345); | ||
fifth = a.arg(undefined); | ||
sixth = a.arg(null); | ||
seventh = a.arg({"test":5}); | ||
eighth = a.arg({"test":5, "again":6}); | ||
} | ||
|
||
if (first != "Value is string") returnValue = false; | ||
if (second != "Value is 1") returnValue = false; | ||
if (third != "Value is true") returnValue = false; | ||
if (fourth != "Value is 3.345") returnValue = false; | ||
if (fifth != "Value is undefined") returnValue = false; | ||
if (sixth != "Value is null") returnValue = false; | ||
if (seventh != "Value is [Object object]") returnValue = false; | ||
if (eighth != "Value is [Object object]") returnValue = false; | ||
returnValue = true; | ||
} | ||
|
||
function failure() { | ||
returnValue = true; | ||
var a = "Value is %1"; | ||
for (var ii = 0; ii < 10; ++ii) { | ||
ninth = a.arg(1,2,3,4); | ||
} | ||
returnValue = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters