Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the evaluation of JS switch statements in QML bindings.
Task-number: QTBUG-17012 Change-Id: Ic132cf63ed08592fec9c759df1b8b4d5830acea6 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
- Loading branch information
Roberto Raggi
authored and
Qt by Nokia
committed
Nov 29, 2011
1 parent
328d1d2
commit 7c83628
Showing
8 changed files
with
321 additions
and
0 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
33 changes: 33 additions & 0 deletions
33
tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.1.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,33 @@ | ||
import Qt.test 1.0 | ||
|
||
MyQmlObject { | ||
value: { | ||
var value = 0 | ||
switch (stringProperty) { | ||
case "A": | ||
value = value + 1 | ||
value = value + 1 | ||
/* should fall through */ | ||
case "S": | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
break; | ||
case "D": { // with curly braces | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
break; | ||
} | ||
case "F": { | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
} | ||
/* should fall through */ | ||
default: | ||
value = value + 1 | ||
} | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.2.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,33 @@ | ||
import Qt.test 1.0 | ||
|
||
MyQmlObject { | ||
value: { | ||
var value = 0 | ||
switch (stringProperty) { | ||
case "A": | ||
value = value + 1 | ||
value = value + 1 | ||
/* should fall through */ | ||
case "S": | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
break; | ||
default: | ||
value = value + 1 | ||
case "D": { // with curly braces | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
break; | ||
} | ||
case "F": { | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
} | ||
/* should fall through */ | ||
} | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.3.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,33 @@ | ||
import Qt.test 1.0 | ||
|
||
MyQmlObject { | ||
value: { | ||
var value = 0 | ||
switch (stringProperty) { | ||
default: | ||
value = value + 1 | ||
case "A": | ||
value = value + 1 | ||
value = value + 1 | ||
/* should fall through */ | ||
case "S": | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
break; | ||
case "D": { // with curly braces | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
break; | ||
} | ||
case "F": { | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
} | ||
/* should fall through */ | ||
} | ||
} | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.4.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,31 @@ | ||
import Qt.test 1.0 | ||
|
||
MyQmlObject { | ||
value: { | ||
var value = 0 | ||
switch (stringProperty) { | ||
case "A": | ||
value = value + 1 | ||
value = value + 1 | ||
/* should fall through */ | ||
case "S": | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
break; | ||
case "D": { // with curly braces | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
break; | ||
} | ||
case "F": { | ||
value = value + 1 | ||
value = value + 1 | ||
value = value + 1 | ||
} | ||
/* should fall through */ | ||
} | ||
} | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
tests/auto/declarative/qdeclarativeecmascript/data/switchStatement.5.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,12 @@ | ||
import Qt.test 1.0 | ||
|
||
MyQmlObject { | ||
value: { | ||
var value = 0 | ||
switch (stringProperty) { | ||
default: | ||
value = value + 1 | ||
} | ||
} | ||
} | ||
|
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