Add string comparison test for v4.

Change-Id: Ibd98608ca0c757afdde1db18877a5a92cdeb24ba
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
This commit is contained in:
Michael Brasser 2012-02-15 09:29:54 +10:00 committed by Qt by Nokia
parent be47ec24cf
commit 0ae106b5d9
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,34 @@
import QtQuick 2.0
QtObject {
property string string1: "aaba"
property string string2: "aa"
property string string3: "aaab"
property string string4: "c"
property bool test1: string1 > string2
property bool test2: string2 < string1
property bool test3: string1 > string3
property bool test4: string3 < string1
property bool test5: string1 < string4
property bool test6: string4 > string1
property bool test7: string1 == "aaba"
property bool test8: string1 != "baa"
property bool test9: string1 === "aaba"
property bool test10: string1 !== "baa"
property bool test11: string4 == "c"
property bool test12: string4 != "d"
property bool test13: string4 === "c"
property bool test14: string4 !== "d"
property bool test15: string1 >= string2
property bool test16: string2 <= string1
property bool test17: string1 >= string3
property bool test18: string3 <= string1
property bool test19: string1 <= string4
property bool test20: string4 >= string1
property bool test21: string4 <= "c"
property bool test22: string4 >= "c"
}

View File

@ -70,6 +70,7 @@ private slots:
void subscriptionsInConditionalExpressions();
void qtbug_21883();
void qtbug_22816();
void stringComparison();
private:
QDeclarativeEngine engine;
@ -272,6 +273,37 @@ void tst_v4::qtbug_22816()
delete o;
}
void tst_v4::stringComparison()
{
QDeclarativeComponent component(&engine, testFileUrl("stringComparison.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("test1").toBool(), true);
QCOMPARE(o->property("test2").toBool(), true);
QCOMPARE(o->property("test3").toBool(), true);
QCOMPARE(o->property("test4").toBool(), true);
QCOMPARE(o->property("test5").toBool(), true);
QCOMPARE(o->property("test6").toBool(), true);
QCOMPARE(o->property("test7").toBool(), true);
QCOMPARE(o->property("test8").toBool(), true);
QCOMPARE(o->property("test9").toBool(), true);
QCOMPARE(o->property("test10").toBool(), true);
QCOMPARE(o->property("test11").toBool(), true);
QCOMPARE(o->property("test12").toBool(), true);
QCOMPARE(o->property("test13").toBool(), true);
QCOMPARE(o->property("test14").toBool(), true);
QCOMPARE(o->property("test15").toBool(), true);
QCOMPARE(o->property("test16").toBool(), true);
QCOMPARE(o->property("test17").toBool(), true);
QCOMPARE(o->property("test18").toBool(), true);
QCOMPARE(o->property("test19").toBool(), true);
QCOMPARE(o->property("test20").toBool(), true);
QCOMPARE(o->property("test21").toBool(), true);
QCOMPARE(o->property("test22").toBool(), true);
delete o;
}
QTEST_MAIN(tst_v4)
#include "tst_v4.moc"