tests/auto/qurl/tst_qurl.cpp
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
child 7 3f74d0d4af4c
equal deleted inserted replaced
4:3b1da2848fc7 5:d3bac044e0f0
    88     void init();
    88     void init();
    89     void cleanup();
    89     void cleanup();
    90 private slots:
    90 private slots:
    91     void getSetCheck();
    91     void getSetCheck();
    92     void constructing();
    92     void constructing();
    93     void isDetached();
       
    94     void assignment();
    93     void assignment();
    95     void comparison();
    94     void comparison();
    96     void copying();
    95     void copying();
    97     void setUrl();
    96     void setUrl();
    98     void i18n_data();
    97     void i18n_data();
   164     void nameprep_testsuite();
   163     void nameprep_testsuite();
   165     void ace_testsuite_data();
   164     void ace_testsuite_data();
   166     void ace_testsuite();
   165     void ace_testsuite();
   167     void std3violations_data();
   166     void std3violations_data();
   168     void std3violations();
   167     void std3violations();
       
   168     void std3deviations_data();
       
   169     void std3deviations();
   169     void tldRestrictions_data();
   170     void tldRestrictions_data();
   170     void tldRestrictions();
   171     void tldRestrictions();
   171     void emptyQueryOrFragment();
   172     void emptyQueryOrFragment();
   172     void hasFragment_data();
   173     void hasFragment_data();
   173     void hasFragment();
   174     void hasFragment();
   315     buildUNC.setHost(QString::fromLatin1("somehost"));
   316     buildUNC.setHost(QString::fromLatin1("somehost"));
   316     buildUNC.setPath(QString::fromLatin1("somepath"));
   317     buildUNC.setPath(QString::fromLatin1("somepath"));
   317     QCOMPARE(buildUNC.toLocalFile(), QString::fromLatin1("//somehost/somepath"));
   318     QCOMPARE(buildUNC.toLocalFile(), QString::fromLatin1("//somehost/somepath"));
   318     buildUNC.toEncoded();
   319     buildUNC.toEncoded();
   319     QVERIFY(!buildUNC.isEmpty());
   320     QVERIFY(!buildUNC.isEmpty());
   320 }
       
   321 
       
   322 void tst_QUrl::isDetached()
       
   323 {
       
   324     QUrl url;
       
   325     QVERIFY(!url.isDetached());
       
   326 
       
   327     url = "http://qt.nokia.com/";
       
   328     QVERIFY(url.isDetached());
       
   329 
       
   330     url.clear();
       
   331     QVERIFY(!url.isDetached());
       
   332 
       
   333     url.setHost("qt.nokia.com");
       
   334     QVERIFY(url.isDetached());
       
   335 
       
   336     QUrl url2 = url;
       
   337     QVERIFY(!url.isDetached());
       
   338     QVERIFY(!url2.isDetached());
       
   339 }
   321 }
   340 
   322 
   341 void tst_QUrl::assignment()
   323 void tst_QUrl::assignment()
   342 {
   324 {
   343     QUrl url("http://qt.nokia.com/");
   325     QUrl url("http://qt.nokia.com/");
  3256 
  3238 
  3257     QTest::newRow("control") << "\033foo" << false;
  3239     QTest::newRow("control") << "\033foo" << false;
  3258     QTest::newRow("bang") << "foo!" << false;
  3240     QTest::newRow("bang") << "foo!" << false;
  3259     QTest::newRow("plus") << "foo+bar" << false;
  3241     QTest::newRow("plus") << "foo+bar" << false;
  3260     QTest::newRow("dot") << "foo.bar";
  3242     QTest::newRow("dot") << "foo.bar";
       
  3243     QTest::newRow("startingdot") << ".bar" << false;
       
  3244     QTest::newRow("startingdot2") << ".example.com" << false;
  3261     QTest::newRow("slash") << "foo/bar" << true;
  3245     QTest::newRow("slash") << "foo/bar" << true;
  3262     QTest::newRow("colon") << "foo:80" << true;
  3246     QTest::newRow("colon") << "foo:80" << true;
  3263     QTest::newRow("question") << "foo?bar" << true;
  3247     QTest::newRow("question") << "foo?bar" << true;
  3264     QTest::newRow("at") << "foo@bar" << true;
  3248     QTest::newRow("at") << "foo@bar" << true;
  3265     QTest::newRow("backslash") << "foo\\bar" << false;
  3249     QTest::newRow("backslash") << "foo\\bar" << false;
  3298     if (validUrl)
  3282     if (validUrl)
  3299         return;  // test ends here for these cases
  3283         return;  // test ends here for these cases
  3300 
  3284 
  3301     url = QUrl("http://" + source + "/some/path");
  3285     url = QUrl("http://" + source + "/some/path");
  3302     QVERIFY(!url.isValid());
  3286     QVERIFY(!url.isValid());
       
  3287 }
       
  3288 
       
  3289 void tst_QUrl::std3deviations_data()
       
  3290 {
       
  3291     QTest::addColumn<QString>("source");
       
  3292 
       
  3293     QTest::newRow("ending-dot") << "example.com.";
       
  3294     QTest::newRow("ending-dot3002") << QString("example.com") + QChar(0x3002);
       
  3295 }
       
  3296 
       
  3297 void tst_QUrl::std3deviations()
       
  3298 {
       
  3299     QFETCH(QString, source);
       
  3300     QVERIFY(!QUrl::toAce(source).isEmpty());
       
  3301 
       
  3302     QUrl url;
       
  3303     url.setHost(source);
       
  3304     QVERIFY(!url.host().isEmpty());
  3303 }
  3305 }
  3304 
  3306 
  3305 void tst_QUrl::tldRestrictions_data()
  3307 void tst_QUrl::tldRestrictions_data()
  3306 {
  3308 {
  3307     QTest::addColumn<QString>("tld");
  3309     QTest::addColumn<QString>("tld");