4826 QString driveName = QLatin1String("V:\\blahblah\\more_blahblah\\"); |
4827 QString driveName = QLatin1String("V:\\blahblah\\more_blahblah\\"); |
4827 driveName.remove(2, INT_MAX); // should be "V:" - instead, it's "V::\\blahblah\\more_blahblah\\" |
4828 driveName.remove(2, INT_MAX); // should be "V:" - instead, it's "V::\\blahblah\\more_blahblah\\" |
4828 QVERIFY(driveName == QLatin1String("V:")); |
4829 QVERIFY(driveName == QLatin1String("V:")); |
4829 } |
4830 } |
4830 |
4831 |
|
4832 void tst_QString::QTBUG10404_compareRef() |
|
4833 { |
|
4834 QString a = "ABCDEFGH"; |
|
4835 |
|
4836 QCOMPARE(QStringRef(&a, 1, 2).compare(QLatin1String("BC")), 0); |
|
4837 QVERIFY(QStringRef(&a, 1, 2).compare(QLatin1String("BCD")) < 0); |
|
4838 QCOMPARE(QStringRef(&a, 1, 2).compare(QLatin1String("Bc"), Qt::CaseInsensitive), 0); |
|
4839 QVERIFY(QStringRef(&a, 1, 2).compare(QLatin1String("bCD"), Qt::CaseInsensitive) < 0); |
|
4840 |
|
4841 QCOMPARE(QStringRef(&a, 1, 2).compare(QString::fromLatin1("BC")), 0); |
|
4842 QVERIFY(QStringRef(&a, 1, 2).compare(QString::fromLatin1("BCD")) < 0); |
|
4843 QCOMPARE(QStringRef(&a, 1, 2).compare(QString::fromLatin1("Bc"), Qt::CaseInsensitive), 0); |
|
4844 QVERIFY(QStringRef(&a, 1, 2).compare(QString::fromLatin1("bCD"), Qt::CaseInsensitive) < 0); |
|
4845 |
|
4846 QCOMPARE(QString::fromLatin1("BC").compare(QStringRef(&a, 1, 2)), 0); |
|
4847 QVERIFY(QString::fromLatin1("BCD").compare(QStringRef(&a, 1, 2)) > 0); |
|
4848 QCOMPARE(QString::fromLatin1("Bc").compare(QStringRef(&a, 1, 2), Qt::CaseInsensitive), 0); |
|
4849 QVERIFY(QString::fromLatin1("bCD").compare(QStringRef(&a, 1, 2), Qt::CaseInsensitive) > 0); |
|
4850 |
|
4851 QCOMPARE(QStringRef(&a, 1, 2).compare(QStringRef(&a, 1, 2)), 0); |
|
4852 QVERIFY(QStringRef(&a, 1, 2).compare(QStringRef(&a, 1, 3)) < 0); |
|
4853 QCOMPARE(QStringRef(&a, 1, 2).compare(QStringRef(&a, 1, 2), Qt::CaseInsensitive), 0); |
|
4854 QVERIFY(QStringRef(&a, 1, 2).compare(QStringRef(&a, 1, 3), Qt::CaseInsensitive) < 0); |
|
4855 |
|
4856 QString a2 = "ABCDEFGh"; |
|
4857 QCOMPARE(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 2)), 0); |
|
4858 QVERIFY(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 3)) < 0); |
|
4859 QCOMPARE(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 2), Qt::CaseInsensitive), 0); |
|
4860 QVERIFY(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 3), Qt::CaseInsensitive) < 0); |
|
4861 } |
|
4862 |
|
4863 |
4831 |
4864 |
4832 QTEST_APPLESS_MAIN(tst_QString) |
4865 QTEST_APPLESS_MAIN(tst_QString) |
4833 |
4866 |
4834 #include "tst_qstring.moc" |
4867 #include "tst_qstring.moc" |