| 690 | } |
| 691 | |
| 692 | void TestPath::QUrl_acceptance() |
| 693 | { |
| 694 | const QUrl baseLocal = QUrl(QStringLiteral("file:///foo.h")); |
| 695 | QCOMPARE(baseLocal.isValid(), true); |
| 696 | QCOMPARE(baseLocal.isRelative(), false); |
| 697 | QCOMPARE(baseLocal, QUrl::fromLocalFile(QStringLiteral("/foo.h"))); |
| 698 | QCOMPARE(baseLocal, QUrl::fromUserInput(QStringLiteral("/foo.h"))); |
| 699 | |
| 700 | QUrl relative(QStringLiteral("bar.h")); |
| 701 | QCOMPARE(relative.isRelative(), true); |
| 702 | QCOMPARE(baseLocal.resolved(relative), QUrl(QStringLiteral("file:///bar.h"))); |
| 703 | QUrl relative2(QStringLiteral("/foo/bar.h")); |
| 704 | QCOMPARE(relative2.isRelative(), true); |
| 705 | QCOMPARE(baseLocal.resolved(relative2), QUrl(QStringLiteral("file:///foo/bar.h"))); |
| 706 | |
| 707 | const QUrl baseRemote = QUrl(QStringLiteral("http://foo.org/asdf/foo/asdf")); |
| 708 | QCOMPARE(baseRemote.resolved(relative), QUrl(QStringLiteral("http://foo.org/asdf/foo/bar.h"))); |
| 709 | } |
| 710 | |
| 711 | #include "moc_test_path.cpp" |