diff options
Diffstat (limited to 'tests/auto/qml')
100 files changed, 1171 insertions, 612 deletions
diff --git a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro index e4d588dc9a..dc6f4c5038 100644 --- a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro +++ b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro @@ -13,5 +13,4 @@ TESTDATA = data/* QT += qml testlib gui-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 - -mac:CONFIG+=insignificant_test #QTBUG-29975 +CONFIG+=insignificant_test diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-1.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-1.js index a4bf1c7de6..87cba8cd2f 100644 --- a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-1.js +++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.2-1.js @@ -252,44 +252,6 @@ for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_ST HEX_VALUE -= Math.pow(16,POWER)*15; } -// let us do some octal tests. numbers that start with 0 and do not provid a radix should -// default to using "0" as a radix. - -var OCT_STRING = "0"; -var OCT_VALUE = 0; - -for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { - new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) ); - OCT_VALUE += Math.pow(8,POWER)*7; -} - -for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { - new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) ); - OCT_VALUE -= Math.pow(8,POWER)*7; -} - -// should get the same results as above if we provid the radix of 8 (or 010) - -for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { - new TestCase( SECTION, "parseInt("+OCT_STRING+",8)", OCT_VALUE, parseInt(OCT_STRING,8) ); - OCT_VALUE += Math.pow(8,POWER)*7; -} -for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { - new TestCase( SECTION, "parseInt("+OCT_STRING+",010)", OCT_VALUE, parseInt(OCT_STRING,010) ); - OCT_VALUE -= Math.pow(8,POWER)*7; -} - -// we shall stop parsing digits when we get one that isn't a numeric literal of the type we think -// it should be. -for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { - new TestCase( SECTION, "parseInt("+OCT_STRING+"8,8)", OCT_VALUE, parseInt(OCT_STRING+"8",8) ); - OCT_VALUE += Math.pow(8,POWER)*7; -} -for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { - new TestCase( SECTION, "parseInt("+OCT_STRING+"8,010)", OCT_VALUE, parseInt(OCT_STRING+"8",010) ); - OCT_VALUE -= Math.pow(8,POWER)*7; -} - new TestCase( SECTION, "parseInt( '0x' )", NaN, diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-1.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-1.js index 56bf83adcc..a89154e597 100644 --- a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-1.js +++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-1.js @@ -384,43 +384,12 @@ new TestCase( SECTION, "parseFloat(0XE)", 14, parseFloat(0XE)); new TestCase( SECTION, "parseFloat(0XF)", 15, parseFloat(0XF)); -// A StringNumericLiteral may not use octal notation - -new TestCase( SECTION, "parseFloat('00')", 0, parseFloat("00")); -new TestCase( SECTION, "parseFloat('01')", 1, parseFloat("01")); -new TestCase( SECTION, "parseFloat('02')", 2, parseFloat("02")); -new TestCase( SECTION, "parseFloat('03')", 3, parseFloat("03")); -new TestCase( SECTION, "parseFloat('04')", 4, parseFloat("04")); -new TestCase( SECTION, "parseFloat('05')", 5, parseFloat("05")); -new TestCase( SECTION, "parseFloat('06')", 6, parseFloat("06")); -new TestCase( SECTION, "parseFloat('07')", 7, parseFloat("07")); -new TestCase( SECTION, "parseFloat('010')", 10, parseFloat("010")); -new TestCase( SECTION, "parseFloat('011')", 11, parseFloat("011")); - // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat('001')", 1, parseFloat("001")); new TestCase( SECTION, "parseFloat('0001')", 1, parseFloat("0001")); new TestCase( SECTION, "parseFloat(' 0001 ')", 1, parseFloat(" 0001 ")); -// an octal numeric literal should be treated as an octal - -new TestCase( SECTION, "parseFloat(00)", 0, parseFloat(00)); -new TestCase( SECTION, "parseFloat(01)", 1, parseFloat(01)); -new TestCase( SECTION, "parseFloat(02)", 2, parseFloat(02)); -new TestCase( SECTION, "parseFloat(03)", 3, parseFloat(03)); -new TestCase( SECTION, "parseFloat(04)", 4, parseFloat(04)); -new TestCase( SECTION, "parseFloat(05)", 5, parseFloat(05)); -new TestCase( SECTION, "parseFloat(06)", 6, parseFloat(06)); -new TestCase( SECTION, "parseFloat(07)", 7, parseFloat(07)); -new TestCase( SECTION, "parseFloat(010)", 8, parseFloat(010)); -new TestCase( SECTION, "parseFloat(011)", 9, parseFloat(011)); - -// A StringNumericLIteral may have any number of leading 0 digits - -new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001)); -new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001)); - // make sure it's reflexive new TestCase( SECTION, "parseFloat(Math.PI)", Math.PI, parseFloat(Math.PI)); new TestCase( SECTION, "parseFloat(Math.LN2)", Math.LN2, parseFloat(Math.LN2)); diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-2.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-2.js index 557b93f637..1167b73ee1 100644 --- a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-2.js +++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.3-2.js @@ -256,28 +256,6 @@ new TestCase( SECTION, "parseFloat(' 0XD')", 0, parseFl new TestCase( SECTION, "parseFloat(' 0XE')", 0, parseFloat(" 0XE")); new TestCase( SECTION, "parseFloat(' 0XF')", 0, parseFloat(" 0XF")); -// A StringNumericLiteral may not use octal notation - -new TestCase( SECTION, "parseFloat(' 00')", 0, parseFloat(" 00")); -new TestCase( SECTION, "parseFloat(' 01')", 1, parseFloat(" 01")); -new TestCase( SECTION, "parseFloat(' 02')", 2, parseFloat(" 02")); -new TestCase( SECTION, "parseFloat(' 03')", 3, parseFloat(" 03")); -new TestCase( SECTION, "parseFloat(' 04')", 4, parseFloat(" 04")); -new TestCase( SECTION, "parseFloat(' 05')", 5, parseFloat(" 05")); -new TestCase( SECTION, "parseFloat(' 06')", 6, parseFloat(" 06")); -new TestCase( SECTION, "parseFloat(' 07')", 7, parseFloat(" 07")); -new TestCase( SECTION, "parseFloat(' 010')", 10, parseFloat(" 010")); -new TestCase( SECTION, "parseFloat(' 011')", 11, parseFloat(" 011")); - -// A StringNumericLIteral may have any number of leading 0 digits - -new TestCase( SECTION, "parseFloat(' 001')", 1, parseFloat(" 001")); -new TestCase( SECTION, "parseFloat(' 0001')", 1, parseFloat(" 0001")); - -// A StringNumericLIteral may have any number of leading 0 digits - -new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001)); -new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001)); // make sure it' s reflexive new TestCase( SECTION, "parseFloat( ' ' +Math.PI+' ')", Math.PI, parseFloat( ' ' +Math.PI+' ')); diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.6.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.6.js index faeeb9e0b0..18f1986d7e 100644 --- a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.6.js +++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.6.js @@ -106,9 +106,6 @@ new TestCase( SECTION, "isNaN( '0xaa' )", false, isNaN( "0xaa" ) new TestCase( SECTION, "isNaN( '0x0A' )", false, isNaN( "0x0A" ) ); new TestCase( SECTION, "isNaN( '0xAA' )", false, isNaN( "0xAA" ) ); -new TestCase( SECTION, "isNaN( 077 )", false, isNaN( 077 ) ); -new TestCase( SECTION, "isNaN( '077' )", false, isNaN( "077" ) ); - new TestCase( SECTION, "isNaN( Number.NaN )", true, isNaN(Number.NaN) ); new TestCase( SECTION, "isNaN( Number.POSITIVE_INFINITY )", false, isNaN(Number.POSITIVE_INFINITY) ); diff --git a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.7.js b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.7.js index e3db5e7931..9eb52a8ff1 100644 --- a/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.7.js +++ b/tests/auto/qml/parserstress/tests/ecma/GlobalObject/15.1.2.7.js @@ -107,9 +107,6 @@ new TestCase( SECTION, "isFinite( '0xaa' )", true, isFinite( "0 new TestCase( SECTION, "isFinite( '0x0A' )", true, isFinite( "0x0A" ) ); new TestCase( SECTION, "isFinite( '0xAA' )", true, isFinite( "0xAA" ) ); -new TestCase( SECTION, "isFinite( 077 )", true, isFinite( 077 ) ); -new TestCase( SECTION, "isFinite( '077' )", true, isFinite( "077" ) ); - new TestCase( SECTION, "isFinite( new String('Infinity') )", false, isFinite(new String("Infinity")) ); new TestCase( SECTION, "isFinite( new String('-Infinity') )", false, isFinite(new String("-Infinity")) ); diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-1.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-1.js index fb13b24e07..3eacb2990f 100644 --- a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-1.js +++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-1.js @@ -85,16 +85,6 @@ new TestCase( SECTION, 0x100000000 ); new TestCase( SECTION, - "077777777777777777", - 2251799813685247, - 077777777777777777 ); - -new TestCase( SECTION, - "077777777777777776", - 2251799813685246, - 077777777777777776 ); - -new TestCase( SECTION, "0x1fffffffffffff", 9007199254740991, 0x1fffffffffffff ); diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-2.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-2.js index 8fbe16cb8f..6121cd54fd 100644 --- a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-2.js +++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3-2.js @@ -74,20 +74,4 @@ new TestCase( SECTION, 9, 9 ); -new TestCase( SECTION, - "09", - 9, - 09 ); - -new TestCase( SECTION, - "099", - 99, - 099 ); - - -new TestCase( SECTION, - "077", - 63, - 077 ); - test(); diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3.js index 9ccb912752..29635596e1 100644 --- a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3.js +++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.3.js @@ -215,24 +215,6 @@ new TestCase( SECTION, "0XE", 14, 0XE ); new TestCase( SECTION, "0XF", 15, 0XF ); -new TestCase( SECTION, "00", 0, 00 ); -new TestCase( SECTION, "01", 1, 01 ); -new TestCase( SECTION, "02", 2, 02 ); -new TestCase( SECTION, "03", 3, 03 ); -new TestCase( SECTION, "04", 4, 04 ); -new TestCase( SECTION, "05", 5, 05 ); -new TestCase( SECTION, "06", 6, 06 ); -new TestCase( SECTION, "07", 7, 07 ); - -new TestCase( SECTION, "000", 0, 000 ); -new TestCase( SECTION, "011", 9, 011 ); -new TestCase( SECTION, "022", 18, 022 ); -new TestCase( SECTION, "033", 27, 033 ); -new TestCase( SECTION, "044", 36, 044 ); -new TestCase( SECTION, "055", 45, 055 ); -new TestCase( SECTION, "066", 54, 066 ); -new TestCase( SECTION, "077", 63, 077 ); - new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 ); new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 ); diff --git a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js index 015a385220..4b799f8df1 100644 --- a/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js +++ b/tests/auto/qml/parserstress/tests/ecma/LexicalConventions/7.7.4.js @@ -76,53 +76,6 @@ new TestCase( SECTION, "\\v", String.fromCharCode(0x000B), "\v" ); // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence -new TestCase( SECTION, "\\00", String.fromCharCode(0x0000), "\00" ); -new TestCase( SECTION, "\\01", String.fromCharCode(0x0001), "\01" ); -new TestCase( SECTION, "\\02", String.fromCharCode(0x0002), "\02" ); -new TestCase( SECTION, "\\03", String.fromCharCode(0x0003), "\03" ); -new TestCase( SECTION, "\\04", String.fromCharCode(0x0004), "\04" ); -new TestCase( SECTION, "\\05", String.fromCharCode(0x0005), "\05" ); -new TestCase( SECTION, "\\06", String.fromCharCode(0x0006), "\06" ); -new TestCase( SECTION, "\\07", String.fromCharCode(0x0007), "\07" ); - -new TestCase( SECTION, "\\010", String.fromCharCode(0x0008), "\010" ); -new TestCase( SECTION, "\\011", String.fromCharCode(0x0009), "\011" ); -new TestCase( SECTION, "\\012", String.fromCharCode(0x000A), "\012" ); -new TestCase( SECTION, "\\013", String.fromCharCode(0x000B), "\013" ); -new TestCase( SECTION, "\\014", String.fromCharCode(0x000C), "\014" ); -new TestCase( SECTION, "\\015", String.fromCharCode(0x000D), "\015" ); -new TestCase( SECTION, "\\016", String.fromCharCode(0x000E), "\016" ); -new TestCase( SECTION, "\\017", String.fromCharCode(0x000F), "\017" ); -new TestCase( SECTION, "\\020", String.fromCharCode(0x0010), "\020" ); -new TestCase( SECTION, "\\042", String.fromCharCode(0x0022), "\042" ); - -new TestCase( SECTION, "\\0", String.fromCharCode(0x0000), "\0" ); -new TestCase( SECTION, "\\1", String.fromCharCode(0x0001), "\1" ); -new TestCase( SECTION, "\\2", String.fromCharCode(0x0002), "\2" ); -new TestCase( SECTION, "\\3", String.fromCharCode(0x0003), "\3" ); -new TestCase( SECTION, "\\4", String.fromCharCode(0x0004), "\4" ); -new TestCase( SECTION, "\\5", String.fromCharCode(0x0005), "\5" ); -new TestCase( SECTION, "\\6", String.fromCharCode(0x0006), "\6" ); -new TestCase( SECTION, "\\7", String.fromCharCode(0x0007), "\7" ); - -new TestCase( SECTION, "\\10", String.fromCharCode(0x0008), "\10" ); -new TestCase( SECTION, "\\11", String.fromCharCode(0x0009), "\11" ); -new TestCase( SECTION, "\\12", String.fromCharCode(0x000A), "\12" ); -new TestCase( SECTION, "\\13", String.fromCharCode(0x000B), "\13" ); -new TestCase( SECTION, "\\14", String.fromCharCode(0x000C), "\14" ); -new TestCase( SECTION, "\\15", String.fromCharCode(0x000D), "\15" ); -new TestCase( SECTION, "\\16", String.fromCharCode(0x000E), "\16" ); -new TestCase( SECTION, "\\17", String.fromCharCode(0x000F), "\17" ); -new TestCase( SECTION, "\\20", String.fromCharCode(0x0010), "\20" ); -new TestCase( SECTION, "\\42", String.fromCharCode(0x0022), "\42" ); - -new TestCase( SECTION, "\\000", String.fromCharCode(0), "\000" ); -new TestCase( SECTION, "\\111", String.fromCharCode(73), "\111" ); -new TestCase( SECTION, "\\222", String.fromCharCode(146), "\222" ); -new TestCase( SECTION, "\\333", String.fromCharCode(219), "\333" ); - -// following line commented out as it causes a compile time error -// new TestCase( SECTION, "\\444", "444", "\444" ); // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence /* @@ -182,9 +135,10 @@ new TestCase( SECTION, "\\x1E1", String.fromCharCode(30)+"1", "\x1E new TestCase( SECTION, "\\x0F0", String.fromCharCode(15)+"0", "\x0F0" ); // G is out of hex range - +/* Invalid testcase: we no longer silently ignore invalid hexadecimal escape sequences. new TestCase( SECTION, "\\xG", "xG", "\xG" ); new TestCase( SECTION, "\\xCG", "xCG", "\xCG" ); +*/ // DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter new TestCase( SECTION, "\\a", "a", "\a" ); @@ -202,13 +156,10 @@ new TestCase( SECTION, "\\o", "o", "\o" ); new TestCase( SECTION, "\\p", "p", "\p" ); new TestCase( SECTION, "\\q", "q", "\q" ); new TestCase( SECTION, "\\s", "s", "\s" ); -new TestCase( SECTION, "\\u", "u", "\u" ); new TestCase( SECTION, "\\w", "w", "\w" ); -new TestCase( SECTION, "\\x", "x", "\x" ); new TestCase( SECTION, "\\y", "y", "\y" ); new TestCase( SECTION, "\\z", "z", "\z" ); -new TestCase( SECTION, "\\9", "9", "\9" ); new TestCase( SECTION, "\\A", "A", "\A" ); new TestCase( SECTION, "\\B", "B", "\B" ); diff --git a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.1.js b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.1.js index 0412742767..abe1095d40 100644 --- a/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.1.js +++ b/tests/auto/qml/parserstress/tests/ecma/Math/15.8.2.1.js @@ -194,11 +194,6 @@ new TestCase( SECTION, Math.abs( -0xfff ) ); new TestCase( SECTION, - "Math.abs( -0777 )", - 511, - Math.abs(-0777 ) ); - -new TestCase( SECTION, "Math.abs('-1e-1')", 0.1, Math.abs('-1e-1') ); diff --git a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-3.js b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-3.js index dc56427395..3141906d5d 100644 --- a/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-3.js +++ b/tests/auto/qml/parserstress/tests/ecma/TypeConversion/9.3.1-3.js @@ -296,16 +296,6 @@ new TestCase( SECTION, 0x100000000 ); new TestCase( SECTION, - "077777777777777777", - 2251799813685247, - 077777777777777777 ); - -new TestCase( SECTION, - "077777777777777776", - 2251799813685246, - 077777777777777776 ); - -new TestCase( SECTION, "0x1fffffffffffff", 9007199254740991, 0x1fffffffffffff ); diff --git a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js index 3e85ac7abf..f2dccd9267 100644 --- a/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js +++ b/tests/auto/qml/parserstress/tests/ecma_2/RegExp/hex-001.js @@ -55,7 +55,10 @@ startTest(); AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] ); AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] ); + +/* Invalid testcase: we no longer silently ignore invalid hexadecimal escape sequences. AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] ); +*/ AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] ); AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] ); diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-002.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-002.js index 401ad43c11..053720d7e9 100644 --- a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-002.js +++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/octal-002.js @@ -125,70 +125,6 @@ expectedmatch = Array(string); addThis(); -/* - * This one should produce a match. The two-character string - * 'a' + '\011' is duplicated in the pattern and test string: - */ -status = inSection(4); -pattern = /.\011/; -string = 'a\011'; -actualmatch = string.match(pattern); -expectedmatch = Array(string); -addThis(); - - -/* - * Same as above, only now, for the second character of the string, - * use the Unicode escape '\u0009' instead of the octal escape '\011' - */ -status = inSection(5); -pattern = /.\011/; -string = 'a\u0009'; -actualmatch = string.match(pattern); -expectedmatch = Array(string); -addThis(); - - -/* - * Same as above, only now for the second character of the string, - * use the hex escape '\x09' instead of the octal escape '\011' - */ -status = inSection(6); -pattern = /.\011/; -string = 'a\x09'; -actualmatch = string.match(pattern); -expectedmatch = Array(string); -addThis(); - - -/* - * Same as above, only now for the second character of the string, - * use the escape '\t' instead of the octal escape '\011' - */ -status = inSection(7); -pattern = /.\011/; -string = 'a\t'; -actualmatch = string.match(pattern); -expectedmatch = Array(string); -addThis(); - - -/* - * Return to the string from Section 1. - * - * Unlike Section 1, use the RegExp() function to create the - * regexp pattern: null character followed by the string '11'. - * - * Since this is exactly what the string is, we should get a match - - */ -status = inSection(8); -string = 'a' + String.fromCharCode(0) + '11'; -pattern = RegExp(string); -actualmatch = string.match(pattern); -expectedmatch = Array(string); -addThis(); - - //------------------------------------------------------------------------------------------------- diff --git a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-85721.js b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-85721.js index bca1a15e19..7b811abc31 100644 --- a/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-85721.js +++ b/tests/auto/qml/parserstress/tests/ecma_3/RegExp/regress-85721.js @@ -111,11 +111,11 @@ testRegExp([status], [re], [str], [result], [expect]); //# Some things for avoiding backslashitis later on. $esc = '\\\\'; $Period = '\.'; -$space = '\040'; $tab = '\t'; +$space = '\x20'; $tab = '\t'; $OpenBR = '\\['; $CloseBR = '\\]'; $OpenParen = '\\('; $CloseParen = '\\)'; -$NonASCII = '\x80-\xff'; $ctrl = '\000-\037'; -$CRlist = '\n\015'; //# note: this should really be only \015. +$NonASCII = '\x80-\xff'; $ctrl = '\0-\x1f'; +$CRlist = '\n\x0d'; //# note: this should really be only \015. // Items 19, 20, 21 $qtext = '[^' + $esc + $NonASCII + $CRlist + '\"]'; // # for within "..." $dtext = '[^' + $esc + $NonASCII + $CRlist + $OpenBR + $CloseBR + ']'; // # for within [...] @@ -226,7 +226,7 @@ $route_addr = '>'; // # > //# Item 3: phrase........ -$phrase_ctrl = '\000-\010\012-\037'; // # like ctrl, but without tab +$phrase_ctrl = '\0-\x08\x0a-\x1f'; // # like ctrl, but without tab //# Like atom-char, but without listing space, and uses phrase_ctrl. //# Since the class is negated, this matches the same as atom-char plus space and tab diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-441477-01.js b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-441477-01.js index 1be199743d..27ddfab51d 100755 --- a/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-441477-01.js +++ b/tests/auto/qml/parserstress/tests/ecma_3/Regress/regress-441477-01.js @@ -37,7 +37,7 @@ var gTestfile = 'regress-441477-01.js'; //----------------------------------------------------------------------------- -var BUGNUMBER = 441477-01; +var BUGNUMBER = 441477.01; var summary = ''; var actual = 'No Exception'; var expect = 'No Exception'; diff --git a/tests/auto/qml/parserstress/tests/ecma_3/String/regress-392378.js b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-392378.js index 368fde1278..59564b272e 100755 --- a/tests/auto/qml/parserstress/tests/ecma_3/String/regress-392378.js +++ b/tests/auto/qml/parserstress/tests/ecma_3/String/regress-392378.js @@ -55,7 +55,7 @@ function test() expect = ["", undefined, ""] + ''; actual = "y".split(/(x)?\1y/) + ''; - reportCompare(expect, actual, summary + ': "y".split(/(x)?\1y/)'); + reportCompare(expect, actual, summary + ': "y".split(/(x)?\\1y/)'); expect = ["", undefined, ""] + ''; actual = "y".split(/(x)?y/) + ''; diff --git a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-02-n.js b/tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-02-n.js deleted file mode 100755 index 0e3c4b0189..0000000000 --- a/tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-02-n.js +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is JavaScript Engine testing utilities. - * - * The Initial Developer of the Original Code is - * Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2007 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): Martin Honnen - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -var gTestfile = 'regress-352044-02-n.js'; -//----------------------------------------------------------------------------- -var BUGNUMBER = 352044; -var summary = 'issues with Unicode escape sequences in JavaScript source code'; -var actual = 'No Error'; -var expect = 'SyntaxError'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - print('This test case is expected to throw an uncaught SyntaxError'); - - try - { - var i = 1; - i \u002b= 1; - print(i); - } - catch(ex) - { - actual = ex + ''; - } - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 55c3fc800a..70b718c4d8 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -2226,15 +2226,10 @@ void tst_QJSEngine::jsContinueInSwitch() void tst_QJSEngine::jsShadowReadOnlyPrototypeProperty() { - // SpiderMonkey has different behavior than JSC and V8; it disallows - // creating a property on the instance if there's a property with the - // same name in the prototype, and that property is read-only. We - // adopted that behavior in the old (4.5) QtScript back-end, but it - // just seems weird -- and non-compliant. Adopt the JSC behavior instead. QJSEngine eng; QVERIFY(eng.evaluate("o = {}; o.__proto__ = parseInt; o.length").isNumber()); - QCOMPARE(eng.evaluate("o.length = 123; o.length").toInt(), 123); - QVERIFY(eng.evaluate("o.hasOwnProperty('length')").toBool()); + QVERIFY(eng.evaluate("o.length = 123; o.length").toInt() != 123); + QVERIFY(!eng.evaluate("o.hasOwnProperty('length')").toBool()); } void tst_QJSEngine::jsReservedWords_data() diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index b77effe3e5..584533c65b 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -23,8 +23,9 @@ PUBLICTESTS += \ qqmlqt \ qqmltranslation \ qqmlxmlhttprequest \ - qqmlparser \ - qquickfolderlistmodel + qtqmlmodules \ + qquickfolderlistmodel \ + qqmlapplicationengine PRIVATETESTS += \ animation \ @@ -42,11 +43,12 @@ PRIVATETESTS += \ qqmlvaluetypes \ qqmlvaluetypeproviders \ qqmlbinding \ - qquickchangeset \ + qqmlchangeset \ qqmlconnections \ - qquicklistcompositor \ - qquicklistmodel \ - qquicklistmodelworkerscript \ + qqmllistcompositor \ + qqmllistmodel \ + qqmllistmodelworkerscript \ + qqmlparser \ qquickworkerscript \ qqmlbundle \ qrcqml \ diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp index a2ac6949ee..65549efddc 100644 --- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp +++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp @@ -112,6 +112,7 @@ void tst_qmlmin::initTestCase() invalidFiles << "tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.js"; invalidFiles << "tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js"; invalidFiles << "tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-02-n.js"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.js"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.js"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.js"; @@ -120,6 +121,14 @@ void tst_qmlmin::initTestCase() invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.js"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.js"; invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.js"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml"; + invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml"; } QStringList tst_qmlmin::findFiles(const QDir &d) diff --git a/tests/auto/qml/qqmlapplicationengine/data/TestItem.qml b/tests/auto/qml/qqmlapplicationengine/data/TestItem.qml new file mode 100644 index 0000000000..e879577e10 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/data/TestItem.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 + +QtObject { +} diff --git a/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml new file mode 100644 index 0000000000..2a1b4fbf57 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml @@ -0,0 +1,14 @@ +import QtQml 2.0 + +QtObject { + property string originalName + property string originalVersion + property string currentName: Qt.application.name + property string currentVersion: Qt.application.version + Component.onCompleted: { + originalName = Qt.application.name + originalVersion = Qt.application.version + Qt.application.name = "Test B" + Qt.application.version = "0.0B" + } +} diff --git a/tests/auto/qml/qqmlapplicationengine/data/basicTest.qml b/tests/auto/qml/qqmlapplicationengine/data/basicTest.qml new file mode 100644 index 0000000000..837835f6df --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/data/basicTest.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property bool success: true +} diff --git a/tests/auto/qml/qqmlapplicationengine/qqmlapplicationengine.pro b/tests/auto/qml/qqmlapplicationengine/qqmlapplicationengine.pro new file mode 100644 index 0000000000..4a2dde7c47 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/qqmlapplicationengine.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = tst_qqmlapplicationengine.pro \ + testapp diff --git a/tests/auto/qml/qqmlapplicationengine/testapp/main.cpp b/tests/auto/qml/qqmlapplicationengine/testapp/main.cpp new file mode 100644 index 0000000000..fe64bb35ad --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/testapp/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QCoreApplication> +#include <QQmlApplicationEngine> + +int main (int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + QQmlApplicationEngine e(QUrl("qrc:///main.qml")); + return app.exec(); +} diff --git a/tests/auto/qml/qqmlapplicationengine/testapp/main.qml b/tests/auto/qml/qqmlapplicationengine/testapp/main.qml new file mode 100644 index 0000000000..c75485a7f7 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/testapp/main.qml @@ -0,0 +1,11 @@ +import QtQml 2.0 + +QtObject { + id: root + property Timer t: Timer { interval: 1; running: true; onTriggered: Qt.quit(); } + property Connections c: Connections { + target: Qt.application + onAboutToQuit: console.log("End"); + } + Component.onCompleted: console.log("Start: " + Qt.application.arguments[1]); +} diff --git a/tests/auto/qml/qqmlapplicationengine/testapp/main.qrc b/tests/auto/qml/qqmlapplicationengine/testapp/main.qrc new file mode 100644 index 0000000000..5f6483ac33 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/testapp/main.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + </qresource> +</RCC> diff --git a/tests/auto/qml/qqmlapplicationengine/testapp/testapp.pro b/tests/auto/qml/qqmlapplicationengine/testapp/testapp.pro new file mode 100644 index 0000000000..34d2718178 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/testapp/testapp.pro @@ -0,0 +1,11 @@ +TEMPLATE = app +TARGET = testapp +DESTDIR = ./ +CONFIG -= app_bundle +CONFIG += console + +QT += qml + +# Input +SOURCES += main.cpp +RESOURCES += main.qrc diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp new file mode 100644 index 0000000000..1c11fcbc73 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../shared/util.h" +#include <QQmlApplicationEngine> +#include <QSignalSpy> +#include <QProcess> +#include <QDebug> + +class tst_qqmlapplicationengine : public QQmlDataTest +{ + Q_OBJECT +public: + tst_qqmlapplicationengine() {} + + +private slots: + void initTestCase(); + void basicLoading(); + void application(); + void applicationProperties(); +private: + QString buildDir; + QString srcDir; +}; + +void tst_qqmlapplicationengine::initTestCase() +{ + buildDir = QDir::currentPath(); + QQmlDataTest::initTestCase(); //Changes current path to src dir + srcDir = QDir::currentPath(); +} + +void tst_qqmlapplicationengine::basicLoading() +{ + int size = 0; + + QQmlApplicationEngine *test = new QQmlApplicationEngine(testFileUrl("basicTest.qml")); + QCOMPARE(test->rootObjects().size(), ++size); + QVERIFY(test->rootObjects()[size -1]); + QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); + + QSignalSpy objectCreated(test, SIGNAL(objectCreated(QObject*,const QUrl&))); + test->load(testFileUrl("basicTest.qml")); + QCOMPARE(objectCreated.count(), size);//one less than rootObjects().size() because we missed the first one + QCOMPARE(test->rootObjects().size(), ++size); + QVERIFY(test->rootObjects()[size -1]); + QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); + + QByteArray testQml("import QtQml 2.0; QtObject{property bool success: true; property TestItem t: TestItem{}}"); + test->loadData(testQml, testFileUrl("dynamicTest.qml")); + QCOMPARE(objectCreated.count(), size); + QCOMPARE(test->rootObjects().size(), ++size); + QVERIFY(test->rootObjects()[size -1]); + QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); + + delete test; +} + +void tst_qqmlapplicationengine::application() +{ + /* This test batches together some tests about running an external application + written with QQmlApplicationEngine. The application tests the following functionality + which is easier to do by watching a separate process: + -Loads relative paths from the working directory + -quits when quit is called + -emits aboutToQuit after quit is called + -has access to application command line arguments + + Note that checking the output means that on builds with extra debugging, this might fail with a false positive. + Also the testapp is automatically built and installed in shadow builds, so it does NOT use testData + */ + QDir::setCurrent(buildDir); + QProcess *testProcess = new QProcess(this); + QTest::ignoreMessage(QtWarningMsg, "Don't know how to handle 'QProcess::ExitStatus', use qRegisterMetaType to register it."); + QSignalSpy processFinished(testProcess, SIGNAL(finished(int,QProcess::ExitStatus))); + QStringList args; + args << QLatin1String("testData"); + testProcess->start(QLatin1String("testapp/testapp"), args); + QTRY_VERIFY(processFinished.count());//Application should immediately exit + QCOMPARE(processFinished[0][0].toInt(), 0); + QByteArray test_stdout = testProcess->readAllStandardOutput(); + QByteArray test_stderr = testProcess->readAllStandardError(); + QByteArray test_stderr_target("Start: testData\nEnd\n"); +#ifdef Q_OS_WIN + test_stderr_target.replace('\n', QByteArray("\r\n")); +#endif + QCOMPARE(test_stdout, QByteArray("")); + QCOMPARE(test_stderr, test_stderr_target); + delete testProcess; + QDir::setCurrent(srcDir); +} + +void tst_qqmlapplicationengine::applicationProperties() +{ + QCoreApplication* coreApp = QCoreApplication::instance(); + QString originalName = coreApp->applicationName(); + QString originalVersion = coreApp->applicationVersion(); + QString firstName = QLatin1String("Test A"); + QString firstVersion = QLatin1String("0.0A"); + QString secondName = QLatin1String("Test B"); + QString secondVersion = QLatin1String("0.0B"); + + coreApp->setApplicationName(firstName); + coreApp->setApplicationVersion(firstVersion); + + QQmlApplicationEngine *test = new QQmlApplicationEngine(testFileUrl("applicationTest.qml")); + QObject* root = test->rootObjects().at(0); + QVERIFY(root); + QCOMPARE(root->property("originalName").toString(), firstName); + QCOMPARE(root->property("originalVersion").toString(), firstVersion); + QCOMPARE(root->property("currentName").toString(), secondName); + QCOMPARE(root->property("currentVersion").toString(), secondVersion); + QCOMPARE(coreApp->applicationName(), secondName); + QCOMPARE(coreApp->applicationVersion(), secondVersion); + + coreApp->setApplicationName(originalName); + coreApp->setApplicationVersion(originalVersion); + delete test; +} + +QTEST_MAIN(tst_qqmlapplicationengine) + +#include "tst_qqmlapplicationengine.moc" diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro new file mode 100644 index 0000000000..18c38a80b6 --- /dev/null +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.pro @@ -0,0 +1,10 @@ +CONFIG += testcase +TARGET = tst_qqmlapplicationengine +macx:CONFIG -= app_bundle + + +SOURCES += tst_qqmlapplicationengine.cpp +TESTDATA += data/* + +include (../../shared/util.pri) +QT += core-private gui-private qml-private network testlib diff --git a/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro b/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro new file mode 100644 index 0000000000..b65e58c0b3 --- /dev/null +++ b/tests/auto/qml/qqmlchangeset/qqmlchangeset.pro @@ -0,0 +1,10 @@ +CONFIG += testcase +TARGET = tst_qqmlhangeset +macx:CONFIG -= app_bundle + +SOURCES += tst_qqmlchangeset.cpp + +CONFIG += parallel_test + +QT += core-private gui-private qml-private testlib +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qquickchangeset/tst_qquickchangeset.cpp b/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp index 77286b04b4..0f09de26d3 100644 --- a/tests/auto/qml/qquickchangeset/tst_qquickchangeset.cpp +++ b/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ #include <qtest.h> -#include <private/qquickchangeset_p.h> +#include <private/qqmlchangeset_p.h> -class tst_qquickchangeset : public QObject +class tst_qqmlchangeset : public QObject { Q_OBJECT private slots: @@ -140,7 +140,7 @@ public: bool applyChanges(QVector<int> &list, const QVector<Signal> &changes) { - QHash<QQuickChangeSet::MoveKey, int> removedValues; + QHash<QQmlChangeSet::MoveKey, int> removedValues; foreach (const Signal &signal, changes) { if (signal.isInsert()) { if (signal.index < 0 || signal.index > list.count()) { @@ -148,7 +148,7 @@ public: return false; } if (signal.moveId != -1) { - QQuickChangeSet::Insert insert(signal.index, signal.count, signal.moveId, signal.offset); + QQmlChangeSet::Insert insert(signal.index, signal.count, signal.moveId, signal.offset); for (int i = insert.start(); i < insert.end(); ++i) list.insert(i, removedValues.take(insert.moveKey(i))); } else { @@ -160,7 +160,7 @@ public: return false; } if (signal.moveId != -1) { - QQuickChangeSet::Remove remove(signal.index, signal.count, signal.moveId, signal.offset); + QQmlChangeSet::Remove remove(signal.index, signal.count, signal.moveId, signal.offset); for (int i = remove.start(); i < remove.end(); ++i) removedValues.insert(remove.moveKey(i), list.at(i)); } @@ -184,7 +184,7 @@ public: }; -bool operator ==(const tst_qquickchangeset::Signal &left, const tst_qquickchangeset::Signal &right) +bool operator ==(const tst_qqmlchangeset::Signal &left, const tst_qqmlchangeset::Signal &right) { return left.index == right.index && left.count == right.count @@ -194,13 +194,13 @@ bool operator ==(const tst_qquickchangeset::Signal &left, const tst_qquickchange } QT_BEGIN_NAMESPACE -bool operator ==(const QQuickChangeSet::Change &left, const QQuickChangeSet::Change &right) +bool operator ==(const QQmlChangeSet::Change &left, const QQmlChangeSet::Change &right) { return left.index == right.index && left.count == right.count && left.moveId == right.moveId; } QT_END_NAMESPACE -QDebug operator <<(QDebug debug, const tst_qquickchangeset::Signal &signal) +QDebug operator <<(QDebug debug, const tst_qqmlchangeset::Signal &signal) { if (signal.isInsert() && signal.moveId == -1) debug.nospace() << "Insert(" << signal.index << "," << signal.count << ")"; @@ -217,8 +217,8 @@ QDebug operator <<(QDebug debug, const tst_qquickchangeset::Signal &signal) return debug; } -Q_DECLARE_METATYPE(tst_qquickchangeset::SignalList) -Q_DECLARE_METATYPE(tst_qquickchangeset::SignalListList) +Q_DECLARE_METATYPE(tst_qqmlchangeset::SignalList) +Q_DECLARE_METATYPE(tst_qqmlchangeset::SignalListList) #if 0 # define VERIFY_EXPECTED_OUTPUT \ @@ -256,7 +256,7 @@ Q_DECLARE_METATYPE(tst_qquickchangeset::SignalListList) } #endif -void tst_qquickchangeset::sequence_data() +void tst_qqmlchangeset::sequence_data() { QTest::addColumn<SignalList>("input"); QTest::addColumn<SignalList>("output"); @@ -1163,12 +1163,12 @@ void tst_qquickchangeset::sequence_data() << Insert(24,1,5,9) << Insert(25,2) << Insert(27,2)); } -void tst_qquickchangeset::sequence() +void tst_qqmlchangeset::sequence() { QFETCH(SignalList, input); QFETCH(SignalList, output); - QQuickChangeSet set; + QQmlChangeSet set; foreach (const Signal &signal, input) { if (signal.isRemove()) @@ -1182,18 +1182,18 @@ void tst_qquickchangeset::sequence() } SignalList changes; - foreach (const QQuickChangeSet::Remove &remove, set.removes()) + foreach (const QQmlChangeSet::Remove &remove, set.removes()) changes << Remove(remove.index, remove.count, remove.moveId, remove.offset); - foreach (const QQuickChangeSet::Insert &insert, set.inserts()) + foreach (const QQmlChangeSet::Insert &insert, set.inserts()) changes << Insert(insert.index, insert.count, insert.moveId, insert.offset); - foreach (const QQuickChangeSet::Change &change, set.changes()) + foreach (const QQmlChangeSet::Change &change, set.changes()) changes << Change(change.index, change.count); VERIFY_EXPECTED_OUTPUT QCOMPARE(changes, output); } -void tst_qquickchangeset::apply_data() +void tst_qqmlchangeset::apply_data() { QTest::addColumn<SignalListList>("input"); @@ -1297,15 +1297,15 @@ void tst_qquickchangeset::apply_data() << (SignalList() << Move(38,23,1,3) << Move(38,31,0,4) << Remove(26,11) << Move(5,7,18,5) << Move(19,0,8,6))); } -void tst_qquickchangeset::apply() +void tst_qqmlchangeset::apply() { QFETCH(SignalListList, input); - QQuickChangeSet set; - QQuickChangeSet linearSet; + QQmlChangeSet set; + QQmlChangeSet linearSet; foreach (const SignalList &list, input) { - QQuickChangeSet intermediateSet; + QQmlChangeSet intermediateSet; foreach (const Signal &signal, list) { if (signal.isRemove()) { intermediateSet.remove(signal.index, signal.count); @@ -1322,15 +1322,15 @@ void tst_qquickchangeset::apply() } SignalList changes; - foreach (const QQuickChangeSet::Remove &remove, set.removes()) + foreach (const QQmlChangeSet::Remove &remove, set.removes()) changes << Remove(remove.index, remove.count, remove.moveId, remove.offset); - foreach (const QQuickChangeSet::Insert &insert, set.inserts()) + foreach (const QQmlChangeSet::Insert &insert, set.inserts()) changes << Insert(insert.index, insert.count, insert.moveId, insert.offset); SignalList linearChanges; - foreach (const QQuickChangeSet::Remove &remove, linearSet.removes()) + foreach (const QQmlChangeSet::Remove &remove, linearSet.removes()) linearChanges << Remove(remove.index, remove.count, remove.moveId, remove.offset); - foreach (const QQuickChangeSet::Insert &insert, linearSet.inserts()) + foreach (const QQmlChangeSet::Insert &insert, linearSet.inserts()) linearChanges << Insert(insert.index, insert.count, insert.moveId, insert.offset); // The output in the failing tests isn't incorrect, merely sub-optimal. @@ -1343,7 +1343,7 @@ void tst_qquickchangeset::apply() QCOMPARE(changes, linearChanges); } -void tst_qquickchangeset::removeConsecutive_data() +void tst_qqmlchangeset::removeConsecutive_data() { QTest::addColumn<SignalList>("input"); QTest::addColumn<SignalList>("output"); @@ -1359,22 +1359,22 @@ void tst_qquickchangeset::removeConsecutive_data() << (SignalList() << Remove(0,2) << Remove(0,1,0,0) << Remove(0,5)); } -void tst_qquickchangeset::removeConsecutive() +void tst_qqmlchangeset::removeConsecutive() { QFETCH(SignalList, input); QFETCH(SignalList, output); - QVector<QQuickChangeSet::Remove> removes; + QVector<QQmlChangeSet::Remove> removes; foreach (const Signal &signal, input) { QVERIFY(signal.isRemove()); - removes.append(QQuickChangeSet::Remove(signal.index, signal.count, signal.moveId, signal.offset)); + removes.append(QQmlChangeSet::Remove(signal.index, signal.count, signal.moveId, signal.offset)); } - QQuickChangeSet set; + QQmlChangeSet set; set.remove(removes); SignalList changes; - foreach (const QQuickChangeSet::Remove &remove, set.removes()) + foreach (const QQmlChangeSet::Remove &remove, set.removes()) changes << Remove(remove.index, remove.count, remove.moveId, remove.offset); QVERIFY(set.inserts().isEmpty()); QVERIFY(set.changes().isEmpty()); @@ -1383,7 +1383,7 @@ void tst_qquickchangeset::removeConsecutive() QCOMPARE(changes, output); } -void tst_qquickchangeset::insertConsecutive_data() +void tst_qqmlchangeset::insertConsecutive_data() { QTest::addColumn<SignalList>("input"); QTest::addColumn<SignalList>("output"); @@ -1399,22 +1399,22 @@ void tst_qquickchangeset::insertConsecutive_data() << (SignalList() << Insert(0,2) << Insert(2,1,0,0) << Insert(3,5)); } -void tst_qquickchangeset::insertConsecutive() +void tst_qqmlchangeset::insertConsecutive() { QFETCH(SignalList, input); QFETCH(SignalList, output); - QVector<QQuickChangeSet::Insert> inserts; + QVector<QQmlChangeSet::Insert> inserts; foreach (const Signal &signal, input) { QVERIFY(signal.isInsert()); - inserts.append(QQuickChangeSet::Insert(signal.index, signal.count, signal.moveId, signal.offset)); + inserts.append(QQmlChangeSet::Insert(signal.index, signal.count, signal.moveId, signal.offset)); } - QQuickChangeSet set; + QQmlChangeSet set; set.insert(inserts); SignalList changes; - foreach (const QQuickChangeSet::Insert &insert, set.inserts()) + foreach (const QQmlChangeSet::Insert &insert, set.inserts()) changes << Insert(insert.index, insert.count, insert.moveId, insert.offset); QVERIFY(set.removes().isEmpty()); QVERIFY(set.changes().isEmpty()); @@ -1423,9 +1423,9 @@ void tst_qquickchangeset::insertConsecutive() QCOMPARE(changes, output); } -void tst_qquickchangeset::copy() +void tst_qqmlchangeset::copy() { - QQuickChangeSet changeSet; + QQmlChangeSet changeSet; changeSet.remove(0, 12); changeSet.remove(5, 4); changeSet.insert(3, 9); @@ -1433,9 +1433,9 @@ void tst_qquickchangeset::copy() changeSet.change(24, 8); changeSet.move(3, 5, 9, 0); - QQuickChangeSet copy(changeSet); + QQmlChangeSet copy(changeSet); - QQuickChangeSet assign; + QQmlChangeSet assign; assign = changeSet; copy.move(4, 2, 5, 1); @@ -1453,27 +1453,27 @@ void tst_qquickchangeset::copy() QCOMPARE(assign.difference(), changeSet.difference()); } -void tst_qquickchangeset::debug() +void tst_qqmlchangeset::debug() { - QQuickChangeSet changeSet; + QQmlChangeSet changeSet; changeSet.remove(0, 12); changeSet.remove(5, 4); changeSet.insert(3, 9); changeSet.insert(15, 2); changeSet.change(24, 8); - QTest::ignoreMessage(QtDebugMsg, "QQuickChangeSet(Remove(0,12) Remove(5,4) Insert(3,9) Insert(15,2) Change(24,8) )"); + QTest::ignoreMessage(QtDebugMsg, "QQmlChangeSet(Remove(0,12) Remove(5,4) Insert(3,9) Insert(15,2) Change(24,8) )"); qDebug() << changeSet; changeSet.clear(); - QTest::ignoreMessage(QtDebugMsg, "QQuickChangeSet(Remove(12,4,0,0) Insert(5,4,0,0) )"); + QTest::ignoreMessage(QtDebugMsg, "QQmlChangeSet(Remove(12,4,0,0) Insert(5,4,0,0) )"); changeSet.move(12, 5, 4, 0); qDebug() << changeSet; } -void tst_qquickchangeset::random_data() +void tst_qqmlchangeset::random_data() { QTest::addColumn<int>("seed"); QTest::addColumn<int>("combinations"); @@ -1484,7 +1484,7 @@ void tst_qquickchangeset::random_data() QTest::newRow("3*5") << 32 << 3 << 5; } -void tst_qquickchangeset::random() +void tst_qqmlchangeset::random() { QFETCH(int, seed); QFETCH(int, combinations); @@ -1494,14 +1494,14 @@ void tst_qquickchangeset::random() int failures = 0; for (int i = 0; i < 20000; ++i) { - QQuickChangeSet accumulatedSet; + QQmlChangeSet accumulatedSet; SignalList input; int modelCount = 40; int moveCount = 0; for (int j = 0; j < combinations; ++j) { - QQuickChangeSet set; + QQmlChangeSet set; for (int k = 0; k < depth; ++k) { switch (-(qrand() % 3)) { case InsertOp: { @@ -1537,9 +1537,9 @@ void tst_qquickchangeset::random() } SignalList output; - foreach (const QQuickChangeSet::Remove &remove, accumulatedSet.removes()) + foreach (const QQmlChangeSet::Remove &remove, accumulatedSet.removes()) output << Remove(remove.index, remove.count, remove.moveId, remove.offset); - foreach (const QQuickChangeSet::Insert &insert, accumulatedSet.inserts()) + foreach (const QQmlChangeSet::Insert &insert, accumulatedSet.inserts()) output << Insert(insert.index, insert.count, insert.moveId, insert.offset); QVector<int> inputList; @@ -1569,6 +1569,6 @@ void tst_qquickchangeset::random() QCOMPARE(failures, 0); } -QTEST_MAIN(tst_qquickchangeset) +QTEST_MAIN(tst_qqmlchangeset) -#include "tst_qquickchangeset.moc" +#include "tst_qqmlchangeset.moc" diff --git a/tests/auto/qml/qqmlecmascript/data/getSet.qml b/tests/auto/qml/qqmlecmascript/data/getSet.qml new file mode 100644 index 0000000000..2987986b38 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/getSet.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + function get(x) { return 1; } + function set(x) { return 1; } + function code() { + var get = 0; + var set = 1; + var o = { + get foo() { return 2; }, + set foo(x) { 1; } + } + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml new file mode 100644 index 0000000000..b9a30ef8b5 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml @@ -0,0 +1,47 @@ +import QtQuick 2.0 + +QtObject { + + // PLEASE NOTE: the function below is whitespace and newline sensitive, + // because that is what the test is all about. + // + // So: DO NOT REFORMAT THE CODE BELOW! + + function code() { +var x=0, y=0; +var z= +x ++ +++ +y + +////////////////////////////////////////////////////////////////////////////// +if (false) { + ; +} +////////////////////////////////////////////////////////////////////////////// + +z= +x ++ ++ +y + +////////////////////////////////////////////////////////////////////////////// +if (false) { + ; +} +////////////////////////////////////////////////////////////////////////////// + +z= +x ++ ++ +y + +////////////////////////////////////////////////////////////////////////////// +if (false) { + ; +} + + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml new file mode 100644 index 0000000000..717cdb5715 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 + +QtObject { + + // PLEASE NOTE: the function below is whitespace and newline sensitive, + // because that is what the test is all about. + // + // So: DO NOT REFORMAT THE CODE BELOW! + + function code() { +var a, b, c; +a=b +++c + +if (a === b) { +} + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml new file mode 100644 index 0000000000..710729cbfe --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 + +QtObject { + + // PLEASE NOTE: the function below is whitespace and newline sensitive, + // because that is what the test is all about. + // + // So: DO NOT REFORMAT THE CODE BELOW! + + function code() { +var x=0, y=0; +var z= +x +++ +++ +y + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.1.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.1.qml new file mode 100644 index 0000000000..1b83a1be0b --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.1.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = 0; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.2.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.2.qml new file mode 100644 index 0000000000..77f13178c3 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.2.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = 1.01; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.3.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.3.qml new file mode 100644 index 0000000000..f20baf305a --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.3.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = 1e-10; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.4.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.4.qml new file mode 100644 index 0000000000..e115dbbbb1 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.4.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = -1.2; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.5.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.5.qml new file mode 100644 index 0000000000..c3db17602a --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.5.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = .4e-5; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.6.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.6.qml new file mode 100644 index 0000000000..471db8708a --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.6.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = 0x1; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing.7.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing.7.qml new file mode 100644 index 0000000000..f8f8e1aae8 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing.7.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = 0Xa; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml new file mode 100644 index 0000000000..61233cbd5b --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = 0x; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml new file mode 100644 index 0000000000..45195452ca --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = 0X; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml new file mode 100644 index 0000000000..71b82b956d --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = "\01"; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml new file mode 100644 index 0000000000..787f1d86c7 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = "\1a"; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml new file mode 100644 index 0000000000..9954617b6b --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = "\012"; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml new file mode 100644 index 0000000000..5bf41f0c1a --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = "\00a"; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml new file mode 100644 index 0000000000..563e01a995 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + var x = "\u000G"; + } +} + diff --git a/tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml new file mode 100644 index 0000000000..8ee5b59d9e --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml @@ -0,0 +1,9 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + "\x0G" + } +} + diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index cc49f234c1..06590f0ad6 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -266,6 +266,9 @@ private slots: void deleteLaterObjectMethodCall(); void automaticSemicolon(); void compatibilitySemicolon(); + void incrDecrSemicolon1(); + void incrDecrSemicolon2(); + void incrDecrSemicolon_error1(); void unaryExpression(); void switchStatement(); void withStatement(); @@ -285,6 +288,8 @@ private slots: void propertyOverride(); void concatenatedStringPropertyAccess(); void jsOwnedObjectsDeletedOnEngineDestroy(); + void numberParsing(); + void stringParsing(); private: static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -1792,10 +1797,7 @@ void tst_qqmlecmascript::functionErrors() object = componentTwo.create(); QVERIFY(object != 0); - QString srpname = object->property("srp_name").toString(); - - warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object ") + srpname - + QLatin1String(" is not a function"); + warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function"); QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); // we expect a meaningful warning to be printed. QMetaObject::invokeMethod(object, "retrieveScarceResource"); delete object; @@ -4111,8 +4113,7 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. - srp_name = object->property("srp_name").toString(); - expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ") + srp_name + QLatin1String(" is not a function"); + expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function"); QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed. QMetaObject::invokeMethod(object, "retrieveScarceResource"); QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred. @@ -4184,8 +4185,7 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. - srp_name = object->property("srp_name").toString(); - expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ") + srp_name + QLatin1String(" is not a function"); + expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function"); QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed. QMetaObject::invokeMethod(object, "retrieveScarceResource"); QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred. @@ -6625,6 +6625,27 @@ void tst_qqmlecmascript::compatibilitySemicolon() QVERIFY(object != 0); } +void tst_qqmlecmascript::incrDecrSemicolon1() +{ + QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon1.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +void tst_qqmlecmascript::incrDecrSemicolon2() +{ + QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +void tst_qqmlecmascript::incrDecrSemicolon_error1() +{ + QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon_error1.qml")); + QObject *object = component.create(); + QVERIFY(object == 0); +} + void tst_qqmlecmascript::unaryExpression() { QQmlComponent component(&engine, testFileUrl("unaryExpression.qml")); @@ -7343,6 +7364,34 @@ void tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy() delete object; } +void tst_qqmlecmascript::numberParsing() +{ + for (int i = 1; i < 8; ++i) { + QString file("numberParsing.%1.qml"); + file = file.arg(i); + QQmlComponent component(&engine, testFileUrl(file)); + QObject *object = component.create(); + QVERIFY(object != 0); + } + for (int i = 1; i < 3; ++i) { + QString file("numberParsing_error.%1.qml"); + file = file.arg(i); + QQmlComponent component(&engine, testFileUrl(file)); + QVERIFY(!component.errors().isEmpty()); + } +} + +void tst_qqmlecmascript::stringParsing() +{ + for (int i = 1; i < 7; ++i) { + QString file("stringParsing_error.%1.qml"); + file = file.arg(i); + QQmlComponent component(&engine, testFileUrl(file)); + QObject *object = component.create(); + QVERIFY(object == 0); + } +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 4e1ac22337..9177ff58f7 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -48,6 +48,7 @@ #include <QStandardPaths> #include <QSignalSpy> #include <QDebug> +#include <QBuffer> #include <QQmlComponent> #include <QQmlNetworkAccessManagerFactory> #include <QQmlExpression> @@ -63,6 +64,7 @@ public: private slots: void rootContext(); void networkAccessManager(); + void synchronousNetworkAccessManager(); void baseUrl(); void contextForObject(); void offlineStoragePath(); @@ -127,6 +129,53 @@ void tst_qqmlengine::networkAccessManager() delete engine; } +class ImmediateReply : public QNetworkReply { + + Q_OBJECT + +public: + ImmediateReply() { + setFinished(true); + } + virtual qint64 readData(char* , qint64 ) { + return 0; + } + virtual void abort() { } +}; + +class ImmediateManager : public QNetworkAccessManager { + + Q_OBJECT + +public: + ImmediateManager(QObject *parent = 0) : QNetworkAccessManager(parent) { + } + + QNetworkReply *createRequest(Operation, const QNetworkRequest & , QIODevice * outgoingData = 0) { + Q_UNUSED(outgoingData); + return new ImmediateReply; + } +}; + +class ImmediateFactory : public QQmlNetworkAccessManagerFactory { + +public: + QNetworkAccessManager *create(QObject *) { + return new ImmediateManager; + } +}; + +void tst_qqmlengine::synchronousNetworkAccessManager() +{ + ImmediateFactory factory; + QQmlEngine engine; + engine.setNetworkAccessManagerFactory(&factory); + QQmlComponent c(&engine, QUrl("myScheme://test.qml")); + // reply is finished, so should not be in loading state. + QVERIFY(!c.isLoading()); +} + + void tst_qqmlengine::baseUrl() { QQmlEngine engine; diff --git a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp index 293eccbf64..793da64734 100644 --- a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp +++ b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp @@ -54,7 +54,7 @@ private slots: void initTestCase(); void colorProviderWarning(); - void guiProviderWarning(); + void noGuiProviderWarning(); }; void tst_qqmlglobal::initTestCase() @@ -68,11 +68,9 @@ void tst_qqmlglobal::colorProviderWarning() QQml_colorProvider(); } -void tst_qqmlglobal::guiProviderWarning() +void tst_qqmlglobal::noGuiProviderWarning() { - const QLatin1String expected("Warning: QQml_guiProvider: no GUI provider has been set! "); - QTest::ignoreMessage(QtWarningMsg, expected.data()); - QQml_guiProvider(); + QVERIFY(QQml_guiProvider()); //No GUI provider, so a default non-zero application instance is returned. } QTEST_MAIN(tst_qqmlglobal) diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType5.qml b/tests/auto/qml/qqmllanguage/data/CompositeType5.qml new file mode 100644 index 0000000000..564468ce90 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/CompositeType5.qml @@ -0,0 +1,2 @@ +CompositeType { +} diff --git a/tests/auto/qml/qqmllanguage/data/CompositeType6.qml b/tests/auto/qml/qqmllanguage/data/CompositeType6.qml new file mode 100644 index 0000000000..a8a2af9318 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/CompositeType6.qml @@ -0,0 +1,2 @@ +CompositeType2 { +} diff --git a/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml b/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml index 717cd84536..4034849df8 100644 --- a/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml +++ b/tests/auto/qml/qqmllanguage/data/assignCompositeToType.qml @@ -8,6 +8,10 @@ QtObject { property QtObject myProperty4 property MyQmlObject myProperty5 property MyQmlObject myProperty6 + property CompositeType myProperty7 + property CompositeType myProperty8 + property CompositeType2 myProperty9 + property CompositeType2 myPropertyA myProperty: CompositeType {} myProperty2: CompositeType2 {} @@ -15,4 +19,8 @@ QtObject { myProperty4: CompositeType4 {} myProperty5: CompositeType2 {} myProperty6: CompositeType4 {} + myProperty7: CompositeType {} + myProperty8: CompositeType5 {} + myProperty9: CompositeType2 {} + myPropertyA: CompositeType6 {} } diff --git a/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.errors.txt b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.errors.txt new file mode 100644 index 0000000000..7a75447a62 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.errors.txt @@ -0,0 +1,2 @@ +3:1:Type RegisteredCompositeType2 unavailable +-1:-1:File not found diff --git a/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.qml b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.qml new file mode 100644 index 0000000000..915a6138d9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.1.qml @@ -0,0 +1,3 @@ +import Test 1.0 + +RegisteredCompositeType2 {} diff --git a/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.errors.txt b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.errors.txt new file mode 100644 index 0000000000..0272619404 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.errors.txt @@ -0,0 +1,2 @@ +3:1:Type RegisteredCompositeType3 unavailable +1:1:Expected a qualified name id diff --git a/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.qml b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.qml new file mode 100644 index 0000000000..43d7f3ee95 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/badCompositeRegistration.2.qml @@ -0,0 +1,3 @@ +import Test 1.0 + +RegisteredCompositeType3 {} diff --git a/tests/auto/qml/qqmllanguage/data/literals.qml b/tests/auto/qml/qqmllanguage/data/literals.qml index ffef050438..564b389760 100644 --- a/tests/auto/qml/qqmllanguage/data/literals.qml +++ b/tests/auto/qml/qqmllanguage/data/literals.qml @@ -2,12 +2,14 @@ import QtQuick 2.0 QtObject { property variant n1: 0xFe32 // hex - property variant n2: 015 // octal + property variant n2: 015 property variant n3: -4.2E11 // floating-point literals property variant n4: .1e9 property variant n5: 3e-12 property variant n6: 3e+12 property variant n7: 0.1e9 + property variant n8: 1152921504606846976 + property variant n9: 100000000000000000000 property variant c1: "\b" // special characters property variant c2: "\f" diff --git a/tests/auto/qml/qqmllanguage/data/registeredCompositeType.qml b/tests/auto/qml/qqmllanguage/data/registeredCompositeType.qml new file mode 100644 index 0000000000..f633a14fa7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/registeredCompositeType.qml @@ -0,0 +1,3 @@ +import Test 1.0 + +RegisteredCompositeType {} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 0f9e328bd9..3121d10265 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -139,6 +139,7 @@ private slots: void registrationOrder(); void readonly(); void receivers(); + void registeredCompositeType(); void basicRemote_data(); void basicRemote(); @@ -467,6 +468,9 @@ void tst_qqmllanguage::errors_data() QTest::newRow("invalidTypeName.4") << "invalidTypeName.4.qml" << "invalidTypeName.4.errors.txt" << false; QTest::newRow("Major version isolation") << "majorVersionIsolation.qml" << "majorVersionIsolation.errors.txt" << false; + + QTest::newRow("badCompositeRegistration.1") << "badCompositeRegistration.1.qml" << "badCompositeRegistration.1.errors.txt" << false; + QTest::newRow("badCompositeRegistration.2") << "badCompositeRegistration.2.qml" << "badCompositeRegistration.2.errors.txt" << false; } @@ -2771,6 +2775,10 @@ void tst_qqmllanguage::initTestCase() QQmlMetaType::registerCustomStringConverter(qMetaTypeId<MyCustomVariantType>(), myCustomVariantTypeConverter); registerTypes(); + // Registered here because it uses testFileUrl + qmlRegisterType(testFileUrl("CompositeType.qml"), "Test", 1, 0, "RegisteredCompositeType"); + qmlRegisterType(testFileUrl("CompositeType.DoesNotExist.qml"), "Test", 1, 0, "RegisteredCompositeType2"); + qmlRegisterType(testFileUrl("invalidRoot.1.qml"), "Test", 1, 0, "RegisteredCompositeType3"); // Registering the TestType class in other modules should have no adverse effects qmlRegisterType<TestType>("org.qtproject.TestPre", 1, 0, "Test"); @@ -2915,6 +2923,17 @@ void tst_qqmllanguage::receivers() delete o; } +void tst_qqmllanguage::registeredCompositeType() +{ + QQmlComponent component(&engine, testFileUrl("registeredCompositeType.qml")); + + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o != 0); + + delete o; +} + // QTBUG-18268 void tst_qqmllanguage::remoteLoadCrash() { @@ -3053,6 +3072,8 @@ void tst_qqmllanguage::literals_data() QTest::newRow("fp3") << "n5" << QVariant(3e-12); QTest::newRow("fp4") << "n6" << QVariant(3e+12); QTest::newRow("fp5") << "n7" << QVariant(0.1e9); + QTest::newRow("large-int1") << "n8" << QVariant((double) 1152921504606846976); + QTest::newRow("large-int2") << "n9" << QVariant(100000000000000000000.); QTest::newRow("special1") << "c1" << QVariant(QString("\b")); QTest::newRow("special2") << "c2" << QVariant(QString("\f")); @@ -3064,8 +3085,8 @@ void tst_qqmllanguage::literals_data() QTest::newRow("special8") << "c8" << QVariant(QString("\"")); QTest::newRow("special9") << "c9" << QVariant(QString("\\")); // We don't handle octal escape sequences - QTest::newRow("special11") << "c10" << QVariant(QString(1, QChar(0xa9))); - QTest::newRow("special12") << "c11" << QVariant(QString(1, QChar(0x00A9))); + QTest::newRow("special10") << "c10" << QVariant(QString(1, QChar(0xa9))); + QTest::newRow("special11") << "c11" << QVariant(QString(1, QChar(0x00A9))); } void tst_qqmllanguage::literals() diff --git a/tests/auto/qml/qquickchangeset/qquickchangeset.pro b/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro index fd8c87baa4..e6c9dc3a29 100644 --- a/tests/auto/qml/qquickchangeset/qquickchangeset.pro +++ b/tests/auto/qml/qqmllistcompositor/qqmllistcompositor.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qquickchangeset +TARGET = tst_qqmllistcompositor macx:CONFIG -= app_bundle -SOURCES += tst_qquickchangeset.cpp +SOURCES += tst_qqmllistcompositor.cpp CONFIG += parallel_test diff --git a/tests/auto/qml/qquicklistcompositor/tst_qquicklistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp index 5be501c94e..d5e85f478d 100644 --- a/tests/auto/qml/qquicklistcompositor/tst_qquicklistcompositor.cpp +++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ #include <qtest.h> -#include <private/qquicklistcompositor_p.h> +#include <private/qqmllistcompositor_p.h> template<typename T, int N> int lengthOf(const T (&)[N]) { return N; } -typedef QQuickListCompositor C; +typedef QQmlListCompositor C; struct Range { @@ -70,9 +70,9 @@ template <typename T> struct Array typedef Array<int> IndexArray; typedef Array<const void *> ListArray; -typedef QVector<QQuickListCompositor::Remove> RemoveList; -typedef QVector<QQuickListCompositor::Insert> InsertList; -typedef QVector<QQuickListCompositor::Change> ChangeList; +typedef QVector<QQmlListCompositor::Remove> RemoveList; +typedef QVector<QQmlListCompositor::Insert> InsertList; +typedef QVector<QQmlListCompositor::Change> ChangeList; typedef QVector<Range> RangeList; @@ -102,7 +102,7 @@ QT_END_NAMESPACE static const C::Group Visible = C::Group(2); static const C::Group Selection = C::Group(3); -class tst_qquicklistcompositor : public QObject +class tst_qqmllistcompositor : public QObject { Q_OBJECT @@ -174,7 +174,7 @@ private slots: void groupDebug(); }; -void tst_qquicklistcompositor::find_data() +void tst_qqmllistcompositor::find_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<C::Group>("startGroup"); @@ -201,7 +201,7 @@ void tst_qquicklistcompositor::find_data() << uint(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag) << 0; } -void tst_qquicklistcompositor::find() +void tst_qqmllistcompositor::find() { QFETCH(RangeList, ranges); QFETCH(C::Group, startGroup); @@ -215,7 +215,7 @@ void tst_qquicklistcompositor::find() QFETCH(uint, rangeFlags); QFETCH(int, rangeIndex); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -224,7 +224,7 @@ void tst_qquicklistcompositor::find() compositor.find(startGroup, startIndex); - QQuickListCompositor::iterator it = compositor.find(group, index); + QQmlListCompositor::iterator it = compositor.find(group, index); QCOMPARE(it.index[C::Cache], cacheIndex); QCOMPARE(it.index[C::Default], defaultIndex); QCOMPARE(it.index[Visible], visibleIndex); @@ -233,7 +233,7 @@ void tst_qquicklistcompositor::find() QCOMPARE(it->index, rangeIndex); } -void tst_qquicklistcompositor::findInsertPosition_data() +void tst_qqmllistcompositor::findInsertPosition_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<C::Group>("group"); @@ -265,7 +265,7 @@ void tst_qquicklistcompositor::findInsertPosition_data() << uint(0) << 0; } -void tst_qquicklistcompositor::findInsertPosition() +void tst_qqmllistcompositor::findInsertPosition() { QFETCH(RangeList, ranges); QFETCH(C::Group, group); @@ -277,14 +277,14 @@ void tst_qquicklistcompositor::findInsertPosition() QFETCH(uint, rangeFlags); QFETCH(int, rangeIndex); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); foreach (const Range &range, ranges) compositor.append(range.list, range.index, range.count, range.flags); - QQuickListCompositor::insert_iterator it = compositor.findInsertPosition(group, index); + QQmlListCompositor::insert_iterator it = compositor.findInsertPosition(group, index); QCOMPARE(it.index[C::Cache], cacheIndex); QCOMPARE(it.index[C::Default], defaultIndex); @@ -294,9 +294,9 @@ void tst_qquicklistcompositor::findInsertPosition() QCOMPARE(it->index, rangeIndex); } -void tst_qquicklistcompositor::insert() +void tst_qqmllistcompositor::insert() { - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -383,7 +383,7 @@ void tst_qquicklistcompositor::insert() } } -void tst_qquicklistcompositor::clearFlags_data() +void tst_qqmllistcompositor::clearFlags_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<C::Group>("group"); @@ -518,7 +518,7 @@ void tst_qquicklistcompositor::clearFlags_data() } } -void tst_qquicklistcompositor::clearFlags() +void tst_qqmllistcompositor::clearFlags() { QFETCH(RangeList, ranges); QFETCH(C::Group, group); @@ -535,7 +535,7 @@ void tst_qquicklistcompositor::clearFlags() QFETCH(IndexArray, selectionIndexes); QFETCH(ListArray, selectionLists); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -577,7 +577,7 @@ void tst_qquicklistcompositor::clearFlags() } } -void tst_qquicklistcompositor::setFlags_data() +void tst_qqmllistcompositor::setFlags_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<C::Group>("group"); @@ -700,7 +700,7 @@ void tst_qquicklistcompositor::setFlags_data() } } -void tst_qquicklistcompositor::setFlags() +void tst_qqmllistcompositor::setFlags() { QFETCH(RangeList, ranges); QFETCH(C::Group, group); @@ -717,7 +717,7 @@ void tst_qquicklistcompositor::setFlags() QFETCH(IndexArray, selectionIndexes); QFETCH(ListArray, selectionLists); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -759,7 +759,7 @@ void tst_qquicklistcompositor::setFlags() } } -void tst_qquicklistcompositor::move_data() +void tst_qqmllistcompositor::move_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<C::Group>("fromGroup"); @@ -985,7 +985,7 @@ void tst_qquicklistcompositor::move_data() } } -void tst_qquicklistcompositor::move() +void tst_qqmllistcompositor::move() { QFETCH(RangeList, ranges); QFETCH(C::Group, fromGroup); @@ -1004,7 +1004,7 @@ void tst_qquicklistcompositor::move() QFETCH(IndexArray, selectionIndexes); QFETCH(ListArray, selectionLists); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -1048,11 +1048,11 @@ void tst_qquicklistcompositor::move() } } -void tst_qquicklistcompositor::moveFromEnd() +void tst_qqmllistcompositor::moveFromEnd() { int listA; void *a = &listA; - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.append(a, 0, 1, C::AppendFlag | C::PrependFlag | C::DefaultFlag); // Moving an item anchors it to that position. @@ -1074,9 +1074,9 @@ void tst_qquicklistcompositor::moveFromEnd() QCOMPARE(it.modelIndex(), 0); } -void tst_qquicklistcompositor::clear() +void tst_qqmllistcompositor::clear() { - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -1097,7 +1097,7 @@ void tst_qquicklistcompositor::clear() QCOMPARE(compositor.count(C::Cache), 0); } -void tst_qquicklistcompositor::listItemsInserted_data() +void tst_qqmllistcompositor::listItemsInserted_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<void *>("list"); @@ -1226,7 +1226,7 @@ void tst_qquicklistcompositor::listItemsInserted_data() } } -void tst_qquicklistcompositor::listItemsInserted() +void tst_qqmllistcompositor::listItemsInserted() { QFETCH(RangeList, ranges); QFETCH(void *, list); @@ -1238,7 +1238,7 @@ void tst_qquicklistcompositor::listItemsInserted() QFETCH(IndexArray, visibleIndexes); QFETCH(IndexArray, selectionIndexes); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -1276,7 +1276,7 @@ void tst_qquicklistcompositor::listItemsInserted() } } -void tst_qquicklistcompositor::listItemsRemoved_data() +void tst_qqmllistcompositor::listItemsRemoved_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<void *>("list"); @@ -1362,7 +1362,7 @@ void tst_qquicklistcompositor::listItemsRemoved_data() } } -void tst_qquicklistcompositor::listItemsRemoved() +void tst_qqmllistcompositor::listItemsRemoved() { QFETCH(RangeList, ranges); QFETCH(void *, list); @@ -1374,7 +1374,7 @@ void tst_qquicklistcompositor::listItemsRemoved() QFETCH(IndexArray, visibleIndexes); QFETCH(IndexArray, selectionIndexes); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -1412,7 +1412,7 @@ void tst_qquicklistcompositor::listItemsRemoved() } } -void tst_qquicklistcompositor::listItemsMoved_data() +void tst_qqmllistcompositor::listItemsMoved_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<void *>("list"); @@ -1554,7 +1554,7 @@ void tst_qquicklistcompositor::listItemsMoved_data() } } -void tst_qquicklistcompositor::listItemsMoved() +void tst_qqmllistcompositor::listItemsMoved() { QFETCH(RangeList, ranges); QFETCH(void *, list); @@ -1568,7 +1568,7 @@ void tst_qquicklistcompositor::listItemsMoved() QFETCH(IndexArray, visibleIndexes); QFETCH(IndexArray, selectionIndexes); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -1608,7 +1608,7 @@ void tst_qquicklistcompositor::listItemsMoved() } } -void tst_qquicklistcompositor::listItemsChanged_data() +void tst_qqmllistcompositor::listItemsChanged_data() { QTest::addColumn<RangeList>("ranges"); QTest::addColumn<void *>("list"); @@ -1640,7 +1640,7 @@ void tst_qquicklistcompositor::listItemsChanged_data() << Change(0, 0, 3, 6, 2, C::DefaultFlag | C::CacheFlag)); } -void tst_qquicklistcompositor::listItemsChanged() +void tst_qqmllistcompositor::listItemsChanged() { QFETCH(RangeList, ranges); QFETCH(void *, list); @@ -1648,7 +1648,7 @@ void tst_qquicklistcompositor::listItemsChanged() QFETCH(int, count); QFETCH(ChangeList, expectedChanges); - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); @@ -1661,12 +1661,12 @@ void tst_qquicklistcompositor::listItemsChanged() QCOMPARE(changes, expectedChanges); } -void tst_qquicklistcompositor::compositorDebug() +void tst_qqmllistcompositor::compositorDebug() { void *a = (void *)0xa0; void *b = (void *)0xb0; - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); compositor.append(a, 0, 2, C::PrependFlag | C::DefaultFlag); @@ -1676,7 +1676,7 @@ void tst_qquicklistcompositor::compositorDebug() compositor.append(a, 2, 3, C::DefaultFlag); QTest::ignoreMessage(QtDebugMsg, - "QQuickListCompositor(00110\n" + "QQmlListCompositor(00110\n" " 0 0 0 0 Range(0xa0 0 2 00P000000000D0\n" " 0 0 2 0 Range(0xa0 2 3 00P00000000000\n" " 0 0 2 0 Range(0xa0 5 2 0AP000000000D0\n" @@ -1687,7 +1687,7 @@ void tst_qquicklistcompositor::compositorDebug() compositor.setFlags(C::Default, 5, 2, SelectionFlag); QTest::ignoreMessage(QtDebugMsg, - "QQuickListCompositor(20110\n" + "QQmlListCompositor(20110\n" " 0 0 0 0 Range(0xa0 0 2 00P000000000D0\n" " 0 0 2 0 Range(0xa0 2 3 00P00000000000\n" " 0 0 2 0 Range(0xa0 5 2 0AP000000000D0\n" @@ -1698,12 +1698,12 @@ void tst_qquicklistcompositor::compositorDebug() qDebug() << compositor; } -void tst_qquicklistcompositor::changeDebug() +void tst_qqmllistcompositor::changeDebug() { void *a = (void *)0xa0; void *b = (void *)0xb0; - QQuickListCompositor compositor; + QQmlListCompositor compositor; compositor.setGroupCount(4); compositor.setDefaultGroups(VisibleFlag | C::DefaultFlag); compositor.append(a, 0, 2, C::PrependFlag | C::DefaultFlag); @@ -1716,14 +1716,14 @@ void tst_qquicklistcompositor::changeDebug() QTest::ignoreMessage(QtDebugMsg, "Change(-1 2 000000010D0 2 0 7 0)"); - qDebug() << QQuickListCompositor::Change(compositor.find(C::Default, 7), 2, SelectionFlag | C::DefaultFlag); + qDebug() << QQmlListCompositor::Change(compositor.find(C::Default, 7), 2, SelectionFlag | C::DefaultFlag); QTest::ignoreMessage(QtDebugMsg, "Remove(9 4 000000000D0 10 0)"); - qDebug() << QQuickListCompositor::Remove(compositor.find(C::Default, 10), 4, C::DefaultFlag, 9); + qDebug() << QQmlListCompositor::Remove(compositor.find(C::Default, 10), 4, C::DefaultFlag, 9); QTest::ignoreMessage(QtDebugMsg, "Insert(9 4 000000000D0 3 0)"); - qDebug() << QQuickListCompositor::Insert(compositor.find(C::Default, 3), 4, C::DefaultFlag, 9); + qDebug() << QQmlListCompositor::Insert(compositor.find(C::Default, 3), 4, C::DefaultFlag, 9); } -void tst_qquicklistcompositor::groupDebug() +void tst_qqmllistcompositor::groupDebug() { QTest::ignoreMessage(QtDebugMsg, "Default "); qDebug() << C::Default; @@ -1733,8 +1733,8 @@ void tst_qquicklistcompositor::groupDebug() qDebug() << Selection; } -QTEST_MAIN(tst_qquicklistcompositor) +QTEST_MAIN(tst_qqmllistcompositor) -#include "tst_qquicklistcompositor.moc" +#include "tst_qqmllistcompositor.moc" diff --git a/tests/auto/qml/qquicklistmodel/data/enumerate.qml b/tests/auto/qml/qqmllistmodel/data/enumerate.qml index f73d66b318..f73d66b318 100644 --- a/tests/auto/qml/qquicklistmodel/data/enumerate.qml +++ b/tests/auto/qml/qqmllistmodel/data/enumerate.qml diff --git a/tests/auto/qml/qquicklistmodel/data/multipleroles.qml b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml index 4a331e2b3e..4a331e2b3e 100644 --- a/tests/auto/qml/qquicklistmodel/data/multipleroles.qml +++ b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml diff --git a/tests/auto/qml/qquicklistmodel/data/setmodelcachelist.qml b/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml index 58bf1ccd04..58bf1ccd04 100644 --- a/tests/auto/qml/qquicklistmodel/data/setmodelcachelist.qml +++ b/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml diff --git a/tests/auto/qml/qquicklistmodel/data/signalhandlers.qml b/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml index 750d99c5a3..750d99c5a3 100644 --- a/tests/auto/qml/qquicklistmodel/data/signalhandlers.qml +++ b/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml diff --git a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro b/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro index e2b88ccec6..ef044f1663 100644 --- a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro +++ b/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qquicklistmodel +TARGET = tst_qqmllistmodel macx:CONFIG -= app_bundle -SOURCES += tst_qquicklistmodel.cpp +SOURCES += tst_qqmllistmodel.cpp include (../../shared/util.pri) diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index 8deaae9902..eec312ec4f 100644 --- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -43,7 +43,7 @@ #include <QtQuick/private/qquicktext_p.h> #include <QtQuick/private/qquickanimation_p.h> #include <QtQml/private/qqmlengine_p.h> -#include <QtQml/private/qquicklistmodel_p.h> +#include <QtQml/private/qqmllistmodel_p.h> #include <QtQml/private/qqmlexpression_p.h> #include <QQmlComponent> @@ -82,17 +82,17 @@ static bool isValidErrorMessage(const QString &msg, bool dynamicRoleTest) return valid; } -class tst_qquicklistmodel : public QQmlDataTest +class tst_qqmllistmodel : public QQmlDataTest { Q_OBJECT public: - tst_qquicklistmodel() + tst_qqmllistmodel() { qRegisterMetaType<QVector<int> >(); } private: - int roleFromName(const QQuickListModel *model, const QString &roleName); + int roleFromName(const QQmlListModel *model, const QString &roleName); static bool compareVariantList(const QVariantList &testList, QVariant object); @@ -132,11 +132,11 @@ private slots: void datetime_data(); }; -bool tst_qquicklistmodel::compareVariantList(const QVariantList &testList, QVariant object) +bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVariant object) { bool allOk = true; - QQuickListModel *model = qobject_cast<QQuickListModel *>(object.value<QObject *>()); + QQmlListModel *model = qobject_cast<QQmlListModel *>(object.value<QObject *>()); if (model == 0) return false; @@ -178,12 +178,12 @@ bool tst_qquicklistmodel::compareVariantList(const QVariantList &testList, QVari return allOk; } -int tst_qquicklistmodel::roleFromName(const QQuickListModel *model, const QString &roleName) +int tst_qqmllistmodel::roleFromName(const QQmlListModel *model, const QString &roleName) { return model->roleNames().key(roleName.toUtf8(), -1); } -void tst_qquicklistmodel::static_types_data() +void tst_qqmllistmodel::static_types_data() { QTest::addColumn<QString>("qml"); QTest::addColumn<QVariant>("value"); @@ -240,7 +240,7 @@ void tst_qquicklistmodel::static_types_data() << QString("<Unknown File>: Can't assign to existing role 'foo' of different type [List -> Number]"); } -void tst_qquicklistmodel::static_types() +void tst_qqmllistmodel::static_types() { QFETCH(QString, qml); QFETCH(QVariant, value); @@ -272,7 +272,7 @@ void tst_qquicklistmodel::static_types() delete obj; } -void tst_qquicklistmodel::static_i18n_data() +void tst_qqmllistmodel::static_i18n_data() { QTest::addColumn<QString>("qml"); QTest::addColumn<QVariant>("value"); @@ -309,7 +309,7 @@ void tst_qquicklistmodel::static_i18n_data() << QString("ListElement: improperly specified QT_TRID_NOOP"); } -void tst_qquicklistmodel::static_i18n() +void tst_qqmllistmodel::static_i18n() { QFETCH(QString, qml); QFETCH(QVariant, value); @@ -341,7 +341,7 @@ void tst_qquicklistmodel::static_i18n() delete obj; } -void tst_qquicklistmodel::static_nestedElements() +void tst_qqmllistmodel::static_nestedElements() { QFETCH(int, elementCount); @@ -379,7 +379,7 @@ void tst_qquicklistmodel::static_nestedElements() delete obj; } -void tst_qquicklistmodel::static_nestedElements_data() +void tst_qqmllistmodel::static_nestedElements_data() { QTest::addColumn<int>("elementCount"); @@ -389,7 +389,7 @@ void tst_qquicklistmodel::static_nestedElements_data() QTest::newRow("many items") << 5; } -void tst_qquicklistmodel::dynamic_data() +void tst_qqmllistmodel::dynamic_data() { QTest::addColumn<QString>("script"); QTest::addColumn<int>("result"); @@ -530,7 +530,7 @@ void tst_qquicklistmodel::dynamic_data() } } -void tst_qquicklistmodel::dynamic() +void tst_qqmllistmodel::dynamic() { QFETCH(QString, script); QFETCH(int, result); @@ -539,7 +539,7 @@ void tst_qquicklistmodel::dynamic() QQuickItem dummyItem0, dummyItem1; QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine::setContextForObject(&model,engine.rootContext()); engine.rootContext()->setContextObject(&model); @@ -561,7 +561,7 @@ void tst_qquicklistmodel::dynamic() QVERIFY(spyCount.count() > 0); } -void tst_qquicklistmodel::enumerate() +void tst_qqmllistmodel::enumerate() { QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("enumerate.qml")); @@ -602,7 +602,7 @@ void tst_qquicklistmodel::enumerate() delete item; } -void tst_qquicklistmodel::error_data() +void tst_qqmllistmodel::error_data() { QTest::addColumn<QString>("qml"); QTest::addColumn<QString>("error"); @@ -652,7 +652,7 @@ void tst_qquicklistmodel::error_data() << "Foo.ListElement - Foo is not a namespace"; } -void tst_qquicklistmodel::error() +void tst_qqmllistmodel::error() { QFETCH(QString, qml); QFETCH(QString, error); @@ -671,7 +671,7 @@ void tst_qquicklistmodel::error() } } -void tst_qquicklistmodel::syncError() +void tst_qqmllistmodel::syncError() { QString qml = "import QtQuick 2.0\nListModel { id: lm; Component.onCompleted: lm.sync() }"; QString error = "file:dummy.qml:2:1: QML ListModel: List sync() can only be called from a WorkerScript"; @@ -689,7 +689,7 @@ void tst_qquicklistmodel::syncError() /* Test model changes from set() are available to the view */ -void tst_qquicklistmodel::set_data() +void tst_qqmllistmodel::set_data() { QTest::addColumn<bool>("dynamicRoles"); @@ -697,12 +697,12 @@ void tst_qquicklistmodel::set_data() QTest::newRow("dynamicRoles") << true; } -void tst_qquicklistmodel::set() +void tst_qqmllistmodel::set() { QFETCH(bool, dynamicRoles); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine::setContextForObject(&model,engine.rootContext()); engine.rootContext()->setContextProperty("model", &model); @@ -727,7 +727,7 @@ void tst_qquicklistmodel::set() /* Test model changes on values returned by get() are available to the view */ -void tst_qquicklistmodel::get() +void tst_qqmllistmodel::get() { QFETCH(QString, expression); QFETCH(int, index); @@ -740,7 +740,7 @@ void tst_qquicklistmodel::get() component.setData( "import QtQuick 2.0\n" "ListModel {}\n", QUrl()); - QQuickListModel *model = qobject_cast<QQuickListModel*>(component.create()); + QQmlListModel *model = qobject_cast<QQmlListModel*>(component.create()); model->setDynamicRoles(dynamicRoles); engine.rootContext()->setContextProperty("model", model); @@ -775,7 +775,7 @@ void tst_qquicklistmodel::get() delete model; } -void tst_qquicklistmodel::get_data() +void tst_qqmllistmodel::get_data() { QTest::addColumn<QString>("expression"); QTest::addColumn<int>("index"); @@ -802,7 +802,7 @@ void tst_qquicklistmodel::get_data() /* Test that the tests run in get() also work for nested list data */ -void tst_qquicklistmodel::get_nested() +void tst_qqmllistmodel::get_nested() { QFETCH(QString, expression); QFETCH(int, index); @@ -818,10 +818,10 @@ void tst_qquicklistmodel::get_nested() component.setData( "import QtQuick 2.0\n" "ListModel {}", QUrl()); - QQuickListModel *model = qobject_cast<QQuickListModel*>(component.create()); + QQmlListModel *model = qobject_cast<QQmlListModel*>(component.create()); model->setDynamicRoles(dynamicRoles); QVERIFY(component.errorString().isEmpty()); - QQuickListModel *childModel; + QQmlListModel *childModel; engine.rootContext()->setContextProperty("model", model); RUNEXPR("model.append({ listRoleA: [\n" @@ -872,7 +872,7 @@ void tst_qquicklistmodel::get_nested() int outerListRole = roleFromName(model, outerListRoleName); QVERIFY(outerListRole >= 0); - childModel = qobject_cast<QQuickListModel*>(model->data(outerListIndex, outerListRole).value<QObject*>()); + childModel = qobject_cast<QQmlListModel*>(model->data(outerListIndex, outerListRole).value<QObject*>()); QVERIFY(childModel); QString extendedExpression = QString("get(%1).%2.%3").arg(outerListIndex).arg(outerListRoleName).arg(expression); @@ -900,20 +900,20 @@ void tst_qquicklistmodel::get_nested() delete model; } -void tst_qquicklistmodel::get_nested_data() +void tst_qqmllistmodel::get_nested_data() { get_data(); } //QTBUG-13754 -void tst_qquicklistmodel::crash_model_with_multiple_roles() +void tst_qqmllistmodel::crash_model_with_multiple_roles() { QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("multipleroles.qml")); QObject *rootItem = component.create(); QVERIFY(component.errorString().isEmpty()); QVERIFY(rootItem != 0); - QQuickListModel *model = rootItem->findChild<QQuickListModel*>("listModel"); + QQmlListModel *model = rootItem->findChild<QQmlListModel*>("listModel"); QVERIFY(model != 0); // used to cause a crash @@ -923,7 +923,7 @@ void tst_qquicklistmodel::crash_model_with_multiple_roles() } //QTBUG-15190 -void tst_qquicklistmodel::set_model_cache() +void tst_qqmllistmodel::set_model_cache() { QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("setmodelcachelist.qml")); @@ -935,7 +935,7 @@ void tst_qquicklistmodel::set_model_cache() delete model; } -void tst_qquicklistmodel::property_changes() +void tst_qqmllistmodel::property_changes() { QFETCH(QString, script_setup); QFETCH(QString, script_change); @@ -946,7 +946,7 @@ void tst_qquicklistmodel::property_changes() QFETCH(bool, dynamicRoles); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine::setContextForObject(&model, engine.rootContext()); engine.rootContext()->setContextObject(&model); @@ -973,7 +973,7 @@ void tst_qquicklistmodel::property_changes() expr.setExpression(script_change); expr.evaluate(); - QVERIFY2(!expr.hasError(), QTest::toString(expr.error())); + QVERIFY2(!expr.hasError(), QTest::toString(expr.error().toString())); // test the object returned by get() emits the correct signals QCOMPARE(connectionsObject->property("gotSignal").toBool(), itemsChanged); @@ -993,7 +993,7 @@ void tst_qquicklistmodel::property_changes() delete connectionsObject; } -void tst_qquicklistmodel::property_changes_data() +void tst_qqmllistmodel::property_changes_data() { QTest::addColumn<QString>("script_setup"); QTest::addColumn<QString>("script_change"); @@ -1066,7 +1066,7 @@ void tst_qquicklistmodel::property_changes_data() } } -void tst_qquicklistmodel::clear_data() +void tst_qqmllistmodel::clear_data() { QTest::addColumn<bool>("dynamicRoles"); @@ -1074,12 +1074,12 @@ void tst_qquicklistmodel::clear_data() QTest::newRow("dynamicRoles") << true; } -void tst_qquicklistmodel::clear() +void tst_qqmllistmodel::clear() { QFETCH(bool, dynamicRoles); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine::setContextForObject(&model, engine.rootContext()); engine.rootContext()->setContextProperty("model", &model); @@ -1111,7 +1111,7 @@ void tst_qquicklistmodel::clear() QCOMPARE(roleNames[2], QByteArray("propertyC")); } -void tst_qquicklistmodel::signal_handlers_data() +void tst_qqmllistmodel::signal_handlers_data() { QTest::addColumn<bool>("dynamicRoles"); @@ -1119,14 +1119,14 @@ void tst_qquicklistmodel::signal_handlers_data() QTest::newRow("dynamicRoles") << true; } -void tst_qquicklistmodel::signal_handlers() +void tst_qqmllistmodel::signal_handlers() { QFETCH(bool, dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("signalhandlers.qml")); QObject *model = component.create(); - QQuickListModel *lm = qobject_cast<QQuickListModel *>(model); + QQmlListModel *lm = qobject_cast<QQmlListModel *>(model); QVERIFY(lm != 0); lm->setDynamicRoles(dynamicRoles); QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString())); @@ -1136,7 +1136,7 @@ void tst_qquicklistmodel::signal_handlers() delete model; } -void tst_qquicklistmodel::role_mode_data() +void tst_qqmllistmodel::role_mode_data() { QTest::addColumn<QString>("script"); QTest::addColumn<int>("result"); @@ -1150,14 +1150,14 @@ void tst_qquicklistmodel::role_mode_data() QTest::newRow("enableDynamic2") << "{dynamicRoles=true;append({'a':1});dynamicRoles=false;dynamicRoles}" << 1 << "<Unknown File>: QML ListModel: unable to enable static roles as this model is not empty!"; } -void tst_qquicklistmodel::role_mode() +void tst_qqmllistmodel::role_mode() { QFETCH(QString, script); QFETCH(int, result); QFETCH(QString, warning); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; QQmlEngine::setContextForObject(&model,engine.rootContext()); engine.rootContext()->setContextObject(&model); QQmlExpression e(engine.rootContext(), &model, script); @@ -1171,10 +1171,10 @@ void tst_qquicklistmodel::role_mode() QCOMPARE(actual,result); } -void tst_qquicklistmodel::string_to_list_crash() +void tst_qqmllistmodel::string_to_list_crash() { QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; QQmlEngine::setContextForObject(&model,engine.rootContext()); engine.rootContext()->setContextObject(&model); QString script = QLatin1String("{append({'a':'data'});get(0).a = [{'x':123}]}"); @@ -1184,7 +1184,7 @@ void tst_qquicklistmodel::string_to_list_crash() e.evaluate(); } -void tst_qquicklistmodel::empty_element_warning_data() +void tst_qqmllistmodel::empty_element_warning_data() { QTest::addColumn<QString>("qml"); QTest::addColumn<bool>("warning"); @@ -1198,7 +1198,7 @@ void tst_qquicklistmodel::empty_element_warning_data() QTest::newRow("role3") << "import QtQuick 2.0\nListModel { ListElement {} ListElement {a:1} ListElement {b:2} }" << false; } -void tst_qquicklistmodel::empty_element_warning() +void tst_qqmllistmodel::empty_element_warning() { QFETCH(QString, qml); QFETCH(bool, warning); @@ -1219,7 +1219,7 @@ void tst_qquicklistmodel::empty_element_warning() delete obj; } -void tst_qquicklistmodel::datetime_data() +void tst_qqmllistmodel::datetime_data() { QTest::addColumn<QString>("qml"); QTest::addColumn<QDateTime>("expected"); @@ -1234,13 +1234,13 @@ void tst_qquicklistmodel::datetime_data() QTest::newRow("dt3") << "{append({'date':dt0});get(0).date=undefined;get(0).date}" << dt; } -void tst_qquicklistmodel::datetime() +void tst_qqmllistmodel::datetime() { QFETCH(QString, qml); QFETCH(QDateTime, expected); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; QQmlEngine::setContextForObject(&model,engine.rootContext()); QDateTime dt0(QDate(1900, 1, 2), QTime( 8, 14)); QDateTime dt1(QDate(2000, 11, 22), QTime(10, 45)); @@ -1253,6 +1253,6 @@ void tst_qquicklistmodel::datetime() QVERIFY(expected == dtResult); } -QTEST_MAIN(tst_qquicklistmodel) +QTEST_MAIN(tst_qqmllistmodel) -#include "tst_qquicklistmodel.moc" +#include "tst_qqmllistmodel.moc" diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/model.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/model.qml index 5973ea8adf..5973ea8adf 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/data/model.qml +++ b/tests/auto/qml/qqmllistmodelworkerscript/data/model.qml diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/script.js b/tests/auto/qml/qqmllistmodelworkerscript/data/script.js index 66a4acb8a8..66a4acb8a8 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/data/script.js +++ b/tests/auto/qml/qqmllistmodelworkerscript/data/script.js diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremoveelement.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.js index cb9dfa66aa..cb9dfa66aa 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremoveelement.js +++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.js diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremoveelement.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.qml index e2361acf6b..e2361acf6b 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremoveelement.qml +++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.qml diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremovelist.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.js index f63dd68839..f63dd68839 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremovelist.js +++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.js diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremovelist.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.qml index bdb5e024d8..bdb5e024d8 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremovelist.qml +++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.qml diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workersync.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.js index 9b8d8fa7f3..9b8d8fa7f3 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/data/workersync.js +++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.js diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workersync.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.qml index c21cd43e7e..c21cd43e7e 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/data/workersync.qml +++ b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.qml diff --git a/tests/auto/qml/qquicklistmodelworkerscript/qquicklistmodelworkerscript.pro b/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro index 07875722f1..14f0604a9b 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/qquicklistmodelworkerscript.pro +++ b/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qquicklistmodelworkerscript +TARGET = tst_qqmllistmodelworkerscript macx:CONFIG -= app_bundle -SOURCES += tst_qquicklistmodelworkerscript.cpp +SOURCES += tst_qqmllistmodelworkerscript.cpp include (../../shared/util.pri) diff --git a/tests/auto/qml/qquicklistmodelworkerscript/tst_qquicklistmodelworkerscript.cpp b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp index 8d5f34c010..a0edfb6891 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/tst_qquicklistmodelworkerscript.cpp +++ b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp @@ -42,7 +42,7 @@ #include <QtQuick/private/qquickitem_p.h> #include <QtQuick/private/qquicktext_p.h> #include <QtQml/private/qqmlengine_p.h> -#include <QtQml/private/qquicklistmodel_p.h> +#include <QtQml/private/qqmllistmodel_p.h> #include <QtQml/private/qqmlexpression_p.h> #include <QQmlComponent> @@ -81,18 +81,18 @@ static bool isValidErrorMessage(const QString &msg, bool dynamicRoleTest) return valid; } -class tst_qquicklistmodelworkerscript : public QQmlDataTest +class tst_qqmllistmodelworkerscript : public QQmlDataTest { Q_OBJECT public: - tst_qquicklistmodelworkerscript() + tst_qqmllistmodelworkerscript() { qRegisterMetaType<QVector<int> >(); } private: - int roleFromName(const QQuickListModel *model, const QString &roleName); - QQuickItem *createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQuickListModel *model); + int roleFromName(const QQmlListModel *model, const QString &roleName); + QQuickItem *createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQmlListModel *model); void waitForWorker(QQuickItem *item); static bool compareVariantList(const QVariantList &testList, QVariant object); @@ -119,11 +119,11 @@ private slots: void dynamic_role(); }; -bool tst_qquicklistmodelworkerscript::compareVariantList(const QVariantList &testList, QVariant object) +bool tst_qqmllistmodelworkerscript::compareVariantList(const QVariantList &testList, QVariant object) { bool allOk = true; - QQuickListModel *model = qobject_cast<QQuickListModel *>(object.value<QObject *>()); + QQmlListModel *model = qobject_cast<QQmlListModel *>(object.value<QObject *>()); if (model == 0) return false; @@ -165,12 +165,12 @@ bool tst_qquicklistmodelworkerscript::compareVariantList(const QVariantList &tes return allOk; } -int tst_qquicklistmodelworkerscript::roleFromName(const QQuickListModel *model, const QString &roleName) +int tst_qqmllistmodelworkerscript::roleFromName(const QQmlListModel *model, const QString &roleName) { return model->roleNames().key(roleName.toUtf8(), -1); } -QQuickItem *tst_qquicklistmodelworkerscript::createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQuickListModel *model) +QQuickItem *tst_qqmllistmodelworkerscript::createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQmlListModel *model) { QQuickItem *item = qobject_cast<QQuickItem*>(component->create()); QQmlEngine::setContextForObject(model, eng->rootContext()); @@ -179,7 +179,7 @@ QQuickItem *tst_qquicklistmodelworkerscript::createWorkerTest(QQmlEngine *eng, Q return item; } -void tst_qquicklistmodelworkerscript::waitForWorker(QQuickItem *item) +void tst_qqmllistmodelworkerscript::waitForWorker(QQuickItem *item) { QQmlProperty prop(item, "done"); QVERIFY(prop.isValid()); @@ -198,7 +198,7 @@ void tst_qquicklistmodelworkerscript::waitForWorker(QQuickItem *item) QVERIFY(prop.read().toBool()); } -void tst_qquicklistmodelworkerscript::dynamic_data() +void tst_qqmllistmodelworkerscript::dynamic_data() { QTest::addColumn<QString>("script"); QTest::addColumn<int>("result"); @@ -339,12 +339,12 @@ void tst_qquicklistmodelworkerscript::dynamic_data() } } -void tst_qquicklistmodelworkerscript::dynamic_worker_data() +void tst_qqmllistmodelworkerscript::dynamic_worker_data() { dynamic_data(); } -void tst_qquicklistmodelworkerscript::dynamic_worker() +void tst_qqmllistmodelworkerscript::dynamic_worker() { QFETCH(QString, script); QFETCH(int, result); @@ -357,7 +357,7 @@ void tst_qquicklistmodelworkerscript::dynamic_worker() // This is same as dynamic() except it applies the test to a ListModel called // from a WorkerScript. - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); @@ -389,12 +389,12 @@ void tst_qquicklistmodelworkerscript::dynamic_worker() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::dynamic_worker_sync_data() +void tst_qqmllistmodelworkerscript::dynamic_worker_sync_data() { dynamic_data(); } -void tst_qquicklistmodelworkerscript::dynamic_worker_sync() +void tst_qqmllistmodelworkerscript::dynamic_worker_sync() { QFETCH(QString, script); QFETCH(int, result); @@ -408,7 +408,7 @@ void tst_qquicklistmodelworkerscript::dynamic_worker_sync() // from the worker script, calls sync(), and tests the changes are reflected in the // list in the main thread - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); @@ -439,7 +439,7 @@ void tst_qquicklistmodelworkerscript::dynamic_worker_sync() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::get_data() +void tst_qqmllistmodelworkerscript::get_data() { QTest::addColumn<QString>("expression"); QTest::addColumn<int>("index"); @@ -463,7 +463,7 @@ void tst_qquicklistmodelworkerscript::get_data() } } -void tst_qquicklistmodelworkerscript::get_worker() +void tst_qqmllistmodelworkerscript::get_worker() { QFETCH(QString, expression); QFETCH(int, index); @@ -471,7 +471,7 @@ void tst_qquicklistmodelworkerscript::get_worker() QFETCH(QVariant, roleValue); QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); @@ -513,12 +513,12 @@ void tst_qquicklistmodelworkerscript::get_worker() delete item; } -void tst_qquicklistmodelworkerscript::get_worker_data() +void tst_qqmllistmodelworkerscript::get_worker_data() { get_data(); } -void tst_qquicklistmodelworkerscript::property_changes_data() +void tst_qqmllistmodelworkerscript::property_changes_data() { QTest::addColumn<QString>("script_setup"); QTest::addColumn<QString>("script_change"); @@ -591,7 +591,7 @@ void tst_qquicklistmodelworkerscript::property_changes_data() } } -void tst_qquicklistmodelworkerscript::property_changes_worker() +void tst_qqmllistmodelworkerscript::property_changes_worker() { QFETCH(QString, script_setup); QFETCH(QString, script_change); @@ -600,7 +600,7 @@ void tst_qquicklistmodelworkerscript::property_changes_worker() QFETCH(bool, itemsChanged); QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("model.qml")); @@ -631,12 +631,12 @@ void tst_qquicklistmodelworkerscript::property_changes_worker() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::property_changes_worker_data() +void tst_qqmllistmodelworkerscript::property_changes_worker_data() { property_changes_data(); } -void tst_qquicklistmodelworkerscript::worker_sync_data() +void tst_qqmllistmodelworkerscript::worker_sync_data() { QTest::addColumn<bool>("dynamicRoles"); @@ -644,11 +644,11 @@ void tst_qquicklistmodelworkerscript::worker_sync_data() QTest::newRow("dynamicRoles") << true; } -void tst_qquicklistmodelworkerscript::worker_sync() +void tst_qqmllistmodelworkerscript::worker_sync() { QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workersync.qml")); @@ -661,7 +661,7 @@ void tst_qquicklistmodelworkerscript::worker_sync() QVERIFY(model.count() == 2); QVariant childData = model.data(0, 0); - QQuickListModel *childModel = qobject_cast<QQuickListModel *>(childData.value<QObject *>()); + QQmlListModel *childModel = qobject_cast<QQmlListModel *>(childData.value<QObject *>()); QVERIFY(childModel); QVERIFY(childModel->count() == 1); @@ -704,16 +704,16 @@ void tst_qquicklistmodelworkerscript::worker_sync() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::worker_remove_element_data() +void tst_qqmllistmodelworkerscript::worker_remove_element_data() { worker_sync_data(); } -void tst_qquicklistmodelworkerscript::worker_remove_element() +void tst_qqmllistmodelworkerscript::worker_remove_element() { QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremoveelement.qml")); @@ -746,7 +746,7 @@ void tst_qquicklistmodelworkerscript::worker_remove_element() { //don't crash if model was deleted earlier - QQuickListModel* model = new QQuickListModel; + QQmlListModel* model = new QQmlListModel; model->setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremoveelement.qml")); @@ -767,16 +767,16 @@ void tst_qquicklistmodelworkerscript::worker_remove_element() } } -void tst_qquicklistmodelworkerscript::worker_remove_list_data() +void tst_qqmllistmodelworkerscript::worker_remove_list_data() { worker_sync_data(); } -void tst_qquicklistmodelworkerscript::worker_remove_list() +void tst_qqmllistmodelworkerscript::worker_remove_list() { QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremovelist.qml")); @@ -808,7 +808,7 @@ void tst_qquicklistmodelworkerscript::worker_remove_list() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::dynamic_role_data() +void tst_qqmllistmodelworkerscript::dynamic_role_data() { QTest::addColumn<QString>("preamble"); QTest::addColumn<QString>("script"); @@ -817,13 +817,13 @@ void tst_qquicklistmodelworkerscript::dynamic_role_data() QTest::newRow("sync1") << "{append({'a':[{'b':1},{'b':2}]})}" << "{get(0).a = 'string';count}" << 1; } -void tst_qquicklistmodelworkerscript::dynamic_role() +void tst_qqmllistmodelworkerscript::dynamic_role() { QFETCH(QString, preamble); QFETCH(QString, script); QFETCH(int, result); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(true); QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("model.qml")); @@ -854,6 +854,6 @@ void tst_qquicklistmodelworkerscript::dynamic_role() qApp->processEvents(); } -QTEST_MAIN(tst_qquicklistmodelworkerscript) +QTEST_MAIN(tst_qqmllistmodelworkerscript) -#include "tst_qquicklistmodelworkerscript.moc" +#include "tst_qqmllistmodelworkerscript.moc" diff --git a/tests/auto/qml/qqmlmetatype/data/CompositeType.qml b/tests/auto/qml/qqmlmetatype/data/CompositeType.qml new file mode 100644 index 0000000000..bc2abca42b --- /dev/null +++ b/tests/auto/qml/qqmlmetatype/data/CompositeType.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property int foo +} diff --git a/tests/auto/qml/qqmlmetatype/data/ImplicitType.qml b/tests/auto/qml/qqmlmetatype/data/ImplicitType.qml new file mode 100644 index 0000000000..ca2bcef5bf --- /dev/null +++ b/tests/auto/qml/qqmlmetatype/data/ImplicitType.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property int bar +} diff --git a/tests/auto/qml/qqmlmetatype/data/testImplicitComposite.qml b/tests/auto/qml/qqmlmetatype/data/testImplicitComposite.qml new file mode 100644 index 0000000000..f838c6995f --- /dev/null +++ b/tests/auto/qml/qqmlmetatype/data/testImplicitComposite.qml @@ -0,0 +1,3 @@ +import "." + +ImplicitType{} diff --git a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro index b24f006bad..a9a6a32a2b 100644 --- a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro +++ b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro @@ -3,6 +3,9 @@ TARGET = tst_qqmlmetatype SOURCES += tst_qqmlmetatype.cpp macx:CONFIG -= app_bundle +TESTDATA = data/* +include (../../shared/util.pri) + CONFIG += parallel_test QT += core-private gui-private qml-private testlib v8-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp index d5dd364e25..90023222d3 100644 --- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp +++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp @@ -41,12 +41,16 @@ #include <qtest.h> #include <qqml.h> +#include <qqmlprivate.h> +#include <qqmlengine.h> +#include <qqmlcomponent.h> #include <private/qqmlmetatype_p.h> #include <private/qqmlpropertyvalueinterceptor_p.h> #include <private/qhashedstring_p.h> +#include "../../shared/util.h" -class tst_qqmlmetatype : public QObject +class tst_qqmlmetatype : public QQmlDataTest { Q_OBJECT public: @@ -60,6 +64,8 @@ private slots: void qmlPropertyValueInterceptorCast(); void qmlType(); void invalidQmlTypeName(); + void registrationType(); + void compositeType(); void isList(); @@ -77,6 +83,13 @@ public: }; QML_DECLARE_TYPE(TestType); +QObject *testTypeProvider(QQmlEngine *engine, QJSEngine *scriptEngine) +{ + Q_UNUSED(engine); + Q_UNUSED(scriptEngine); + return new TestType(); +} + class ParserStatusTestType : public QObject, public QQmlParserStatus { Q_OBJECT @@ -108,10 +121,15 @@ QML_DECLARE_TYPE(ValueInterceptorTestType); void tst_qqmlmetatype::initTestCase() { + QQmlDataTest::initTestCase(); qmlRegisterType<TestType>("Test", 1, 0, "TestType"); + qmlRegisterSingletonType<TestType>("Test", 1, 0, "TestTypeSingleton", testTypeProvider); qmlRegisterType<ParserStatusTestType>("Test", 1, 0, "ParserStatusTestType"); qmlRegisterType<ValueSourceTestType>("Test", 1, 0, "ValueSourceTestType"); qmlRegisterType<ValueInterceptorTestType>("Test", 1, 0, "ValueInterceptorTestType"); + + QUrl testTypeUrl(testFileUrl("CompositeType.qml")); + qmlRegisterType(testTypeUrl, "Test", 1, 0, "TestTypeComposite"); } void tst_qqmlmetatype::qmlParserStatusCast() @@ -228,6 +246,44 @@ void tst_qqmlmetatype::defaultObject() QCOMPARE(QString(QQmlMetaType::defaultProperty(&t).name()), QString("foo")); } +void tst_qqmlmetatype::registrationType() +{ + QQmlType *type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"), 1, 0); + QVERIFY(type); + QVERIFY(!type->isInterface()); + QVERIFY(!type->isSingleton()); + QVERIFY(!type->isComposite()); + + type = QQmlMetaType::qmlType(QString("TestTypeSingleton"), QString("Test"), 1, 0); + QVERIFY(type); + QVERIFY(!type->isInterface()); + QVERIFY(type->isSingleton()); + QVERIFY(!type->isComposite()); + + type = QQmlMetaType::qmlType(QString("TestTypeComposite"), QString("Test"), 1, 0); + QVERIFY(type); + QVERIFY(!type->isInterface()); + QVERIFY(!type->isSingleton()); + QVERIFY(type->isComposite()); +} + +void tst_qqmlmetatype::compositeType() +{ + QQmlEngine engine; + + //Loading the test file also loads all composite types it imports + QQmlComponent c(&engine, testFileUrl("testImplicitComposite.qml")); + QObject* obj = c.create(); + QVERIFY(obj); + + QQmlType *type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0); + QVERIFY(type); + QVERIFY(type->module() == QLatin1String("")); + QVERIFY(type->elementName() == QLatin1String("ImplicitType")); + QCOMPARE(type->qmlTypeName(), QLatin1String("ImplicitType")); + QCOMPARE(type->sourceUrl(), testFileUrl("ImplicitType.qml")); +} + QTEST_MAIN(tst_qqmlmetatype) #include "tst_qqmlmetatype.moc" diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir b/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir deleted file mode 100644 index 0a8b5d46eb..0000000000 --- a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin plugin diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp index ae37b6a4fb..fa3b190826 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -161,7 +161,7 @@ public: private slots: void initTestCase() Q_DECL_OVERRIDE; void cleanupTestCase(); - void connectNotify(); + void testConnectNotify(); void removeV4Binding(); void removeV4Binding2(); @@ -215,7 +215,7 @@ void tst_qqmlnotifier::cleanupTestCase() exportedObject = 0; } -void tst_qqmlnotifier::connectNotify() +void tst_qqmlnotifier::testConnectNotify() { createObjects(); diff --git a/tests/auto/qml/qqmlparser/qqmlparser.pro b/tests/auto/qml/qqmlparser/qqmlparser.pro index f181a876e8..c666b71d6c 100644 --- a/tests/auto/qml/qqmlparser/qqmlparser.pro +++ b/tests/auto/qml/qqmlparser/qqmlparser.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qqmlparser -QT += qmldevtools-private testlib gui-private +QT += qml-private testlib macx:CONFIG -= app_bundle SOURCES += tst_qqmlparser.cpp diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp index ec55709d35..3d08ec3e16 100644 --- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -75,15 +75,9 @@ using namespace QQmlJS; class Check: public AST::Visitor { - Engine *engine; QList<AST::Node *> nodeStack; public: - Check(Engine *engine) - : engine(engine) - { - } - void operator()(AST::Node *node) { AST::Node::accept(node, this); @@ -206,7 +200,7 @@ void tst_qqmlparser::qmlParser() else parser.parseProgram(); - check::Check chk(&engine); + check::Check chk; chk(parser.rootNode()); } #endif diff --git a/tests/auto/qml/qquicklistcompositor/qquicklistcompositor.pro b/tests/auto/qml/qquicklistcompositor/qquicklistcompositor.pro deleted file mode 100644 index 9d1d2bd237..0000000000 --- a/tests/auto/qml/qquicklistcompositor/qquicklistcompositor.pro +++ /dev/null @@ -1,10 +0,0 @@ -CONFIG += testcase -TARGET = tst_qquicklistcompositor -macx:CONFIG -= app_bundle - -SOURCES += tst_qquicklistcompositor.cpp - -CONFIG += parallel_test - -QT += core-private gui-private qml-private quick-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp index 46e0c9e436..a2bf06c2ba 100644 --- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp +++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp @@ -145,7 +145,7 @@ void tst_QQuickWorkerScript::messaging_data() void tst_QQuickWorkerScript::messaging_sendQObjectList() { - // Not allowed to send QObjects other than QQuickListModelWorkerAgent + // Not allowed to send QObjects other than QQmlListModelWorkerAgent // instances. If objects are sent in a list, they will be sent as 'undefined' // js values. diff --git a/tests/auto/qml/qtqmlmodules/data/base.qml b/tests/auto/qml/qtqmlmodules/data/base.qml new file mode 100644 index 0000000000..942b270572 --- /dev/null +++ b/tests/auto/qml/qtqmlmodules/data/base.qml @@ -0,0 +1,14 @@ +import QtQml 2.0 + +QtObject { + property bool success: { + prop1 != undefined && + prop2 != undefined && + prop3 != undefined && + prop4 != undefined + } + property Component prop1: Component { QtObject {}} + property Timer prop2: Timer {} + property Connections prop3: Connections{} + property Binding prop4: Binding{} +} diff --git a/tests/auto/qml/qtqmlmodules/data/models.qml b/tests/auto/qml/qtqmlmodules/data/models.qml new file mode 100644 index 0000000000..d253565932 --- /dev/null +++ b/tests/auto/qml/qtqmlmodules/data/models.qml @@ -0,0 +1,15 @@ +import QtQml 2.0 +import QtQml.Models 2.1 + +QtObject { + property bool success: { + prop1 != undefined && + prop2 != undefined && + prop3 != undefined && + prop4 != undefined + } + property DelegateModelGroup prop1: DelegateModelGroup{} + property DelegateModel prop2: DelegateModel{} + property ObjectModel prop3: ObjectModel{} + property ListModel prop4: ListModel{ListElement{dummy: true}} +} diff --git a/tests/auto/qml/qtqmlmodules/data/unavailable.qml b/tests/auto/qml/qtqmlmodules/data/unavailable.qml new file mode 100644 index 0000000000..5841e3f677 --- /dev/null +++ b/tests/auto/qml/qtqmlmodules/data/unavailable.qml @@ -0,0 +1,35 @@ +import QtQml 2.0 + +QtObject { + id: root + property bool success: false; + Component.onCompleted: { + var strings = [ + "QtObject{}", + "Binding{}", + "Connections{}", + "Timer{}", + "Component{QtObject{}}", + "ListModel{ListElement{}}", + "ObjectModel{QtObject{}}", + "import QtQml 2.0 Item{}", + "import QtQml 2.0 ListModel{}", + "import QtQml 2.0 ObjectModel{}" + ]; + var idx; + for (idx in strings) { + var errored = false; + var item; + try { + item = Qt.createQmlObject(strings[idx], root); + } catch (err) { + errored = true; + } + if (!errored) { + console.log("It worked? ", item); + return; + } + } + root.success = true; + } +} diff --git a/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro b/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro new file mode 100644 index 0000000000..36ece8d7e0 --- /dev/null +++ b/tests/auto/qml/qtqmlmodules/qtqmlmodules.pro @@ -0,0 +1,12 @@ +CONFIG += testcase +TARGET = tst_qtqmlmodules +SOURCES += tst_qtqmlmodules.cpp + +include (../../shared/util.pri) + +macx:CONFIG -= app_bundle + +TESTDATA = data/* + +QT += core-private v8-private qml-private testlib gui gui-private +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp b/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp new file mode 100644 index 0000000000..1e98c53694 --- /dev/null +++ b/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research in Motion. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QDebug> +#include <QQmlEngine> +#include <QQmlComponent> +#include "../../shared/util.h" + +class tst_qtqmlmodules : public QQmlDataTest +{ + Q_OBJECT +public: + tst_qtqmlmodules() {} + +private slots: + void baseTypes(); + void modelsTypes(); + void unavailableTypes(); +}; + +void tst_qtqmlmodules::baseTypes() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("base.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->property("success").toBool()); + + delete object; +} + +void tst_qtqmlmodules::modelsTypes() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("models.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->property("success").toBool()); + + delete object; +} + +void tst_qtqmlmodules::unavailableTypes() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("unavailable.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->property("success").toBool()); + + delete object; +} + +QTEST_MAIN(tst_qtqmlmodules) + +#include "tst_qtqmlmodules.moc" diff --git a/tests/auto/qml/v4/data/equals.qml b/tests/auto/qml/v4/data/equals.qml index c32603cc7e..2862bb7ac9 100644 --- a/tests/auto/qml/v4/data/equals.qml +++ b/tests/auto/qml/v4/data/equals.qml @@ -44,5 +44,8 @@ QtObject { property bool test32: true != zero property bool test33: true == 1 property bool test34: true != 1 + + property bool test35: "a\ +b" === "ab" } |