summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdesktopservices
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qdesktopservices')
-rw-r--r--tests/auto/qdesktopservices/qdesktopservices.pro16
-rw-r--r--tests/auto/qdesktopservices/tst_qdesktopservices.cpp176
2 files changed, 96 insertions, 96 deletions
diff --git a/tests/auto/qdesktopservices/qdesktopservices.pro b/tests/auto/qdesktopservices/qdesktopservices.pro
index 3c96e85..7c1bdb9 100644
--- a/tests/auto/qdesktopservices/qdesktopservices.pro
+++ b/tests/auto/qdesktopservices/qdesktopservices.pro
@@ -10,22 +10,22 @@ symbian: {
dummy.path = .
text.sources = text\*
- text.path = \data\others\
+ text.path = \data\others\
image.sources = image\*
image.path = \data\images\
-
+
audio.sources = audio\*
audio.path = \data\sounds\
-
+
video.sources = video\*
- video.path = \data\videos\
-
+ video.path = \data\videos\
+
install.sources = install\*
- install.path = \data\installs\
-
+ install.path = \data\installs\
+
DEPLOYMENT += image audio video install
-
+
# These are only needed for manual tests
#DEPLOYMENT += dummy text
}
diff --git a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
index c69b112..5e3ae4a 100644
--- a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
+++ b/tests/auto/qdesktopservices/tst_qdesktopservices.cpp
@@ -61,16 +61,16 @@ private slots:
void cleanup();
void openUrl();
#ifdef Q_OS_SYMBIAN
- // These test are manual ones, you need to check from device that
+ // These test are manual ones, you need to check from device that
// correct system application is started with correct content
- // When you want to run these test, uncomment //#define RUN_MANUAL_TESTS
+ // When you want to run these test, uncomment //#define RUN_MANUAL_TESTS
void openHttpUrl_data();
void openHttpUrl();
void openMailtoUrl_data();
- void openMailtoUrl();
+ void openMailtoUrl();
void openFileUrl_data();
void openFileUrl();
-#endif
+#endif
void handlers();
void storageLocation_data();
void storageLocation();
@@ -104,7 +104,7 @@ void tst_qdesktopservices::openUrl()
// At the bare minimum check that they return false for invalid url's
QCOMPARE(QDesktopServices::openUrl(QUrl()), false);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- // this test is only valid on windows on other systems it might mean open a new document in the application handling .file
+ // this test is only valid on windows on other systems it might mean open a new document in the application handling .file
QCOMPARE(QDesktopServices::openUrl(QUrl("file://invalid.file")), false);
#endif
}
@@ -112,32 +112,32 @@ void tst_qdesktopservices::openUrl()
#ifdef Q_OS_SYMBIAN
void tst_qdesktopservices::openHttpUrl_data()
{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<bool>("result");
- QTest::newRow("BasicWithHttp") << QUrl("http://www.google.fi") << true;
- QTest::newRow("BasicWithoutHttp") << QUrl("www.nokia.fi") << true;
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<bool>("result");
+ QTest::newRow("BasicWithHttp") << QUrl("http://www.google.fi") << true;
+ QTest::newRow("BasicWithoutHttp") << QUrl("www.nokia.fi") << true;
QTest::newRow("BasicWithUserAndPw") << QUrl("http://s60prereleases:oslofjord@pepper.troll.no/s60prereleases/patches/") << true;
QTest::newRow("URL with space") << QUrl("http://www.manataka.org/Contents Page.html") << true;
-
+
}
void tst_qdesktopservices::openHttpUrl()
{
-#ifndef RUN_MANUAL_TESTS
- QSKIP("Test disabled -- only for manual purposes", SkipAll);
-#endif
-
- QFETCH(QUrl, url);
- QFETCH(bool, result);
- QCOMPARE(QDesktopServices::openUrl(url), result);
+#ifndef RUN_MANUAL_TESTS
+ QSKIP("Test disabled -- only for manual purposes", SkipAll);
+#endif
+
+ QFETCH(QUrl, url);
+ QFETCH(bool, result);
+ QCOMPARE(QDesktopServices::openUrl(url), result);
QTest::qWait(30000);
}
void tst_qdesktopservices::openMailtoUrl_data()
{
QTest::addColumn<QUrl>("url");
- QTest::addColumn<bool>("result");
-
+ QTest::addColumn<bool>("result");
+
// http://en.wikipedia.org/wiki/E-mail_address
// RFC Valid e-mail addresses
QTest::newRow("Wiki valid email 1") << QUrl("mailto:abc@example.com") << true;
@@ -149,97 +149,97 @@ void tst_qdesktopservices::openMailtoUrl_data()
QTest::newRow("Wiki valid email 7") << QUrl("mailto:abc+mailbox/department=shipping@example.com") << true;
// S60 email client considers the next URL invalid, even ity should be valid
QTest::newRow("Wiki valid email 8") << QUrl("mailto:!#$%&'*+-/=?^_`.{|}~@example.com") << true; // all of these characters are allowed
- QTest::newRow("Wiki valid email 9") << QUrl("mailto:\"abc@def\"@example.com") << true; // anything goes inside quotation marks
+ QTest::newRow("Wiki valid email 9") << QUrl("mailto:\"abc@def\"@example.com") << true; // anything goes inside quotation marks
QTest::newRow("Wiki valid email 10") << QUrl("mailto:\"Fred \\\"quota\\\" Bloggs\"@example.com") << true; // however, quotes need escaping
-
- // RFC invalid e-mail addresses
- // These return true even though they are invalid, but check that user is notified about invalid URL in mail application
- QTest::newRow("Wiki invalid email 1") << QUrl("mailto:Abc.example.com") << true; // character @ is missing
- QTest::newRow("Wiki invalid email 2") << QUrl("mailto:Abc.@example.com") << true; // character dot(.) is last in local part
- QTest::newRow("Wiki invalid email 3") << QUrl("mailto:Abc..123@example.com") << true; // character dot(.) is double
- QTest::newRow("Wiki invalid email 4") << QUrl("mailto:A@b@c@example.com") << true; // only one @ is allowed outside quotations marks
- QTest::newRow("Wiki invalid email 5") << QUrl("mailto:()[]\\;:,<>@example.com") << true; // none of the characters before the @ is allowed outside quotation marks
-
- QTest::newRow("Basic") << QUrl("mailto:test@nokia.com") << true;
+
+ // RFC invalid e-mail addresses
+ // These return true even though they are invalid, but check that user is notified about invalid URL in mail application
+ QTest::newRow("Wiki invalid email 1") << QUrl("mailto:Abc.example.com") << true; // character @ is missing
+ QTest::newRow("Wiki invalid email 2") << QUrl("mailto:Abc.@example.com") << true; // character dot(.) is last in local part
+ QTest::newRow("Wiki invalid email 3") << QUrl("mailto:Abc..123@example.com") << true; // character dot(.) is double
+ QTest::newRow("Wiki invalid email 4") << QUrl("mailto:A@b@c@example.com") << true; // only one @ is allowed outside quotations marks
+ QTest::newRow("Wiki invalid email 5") << QUrl("mailto:()[]\\;:,<>@example.com") << true; // none of the characters before the @ is allowed outside quotation marks
+
+ QTest::newRow("Basic") << QUrl("mailto:test@nokia.com") << true;
QTest::newRow("BasicSeveralAddr") << QUrl("mailto:test@nokia.com,test2@nokia.com,test3@nokia.com") << true;
- QTest::newRow("BasicAndSubject") << QUrl("mailto:test@nokia.com?subject=hello nokia") << true;
- QTest::newRow("BasicAndTo") << QUrl("mailto:test@nokia.com?to=test2@nokia.com") << true;
-
+ QTest::newRow("BasicAndSubject") << QUrl("mailto:test@nokia.com?subject=hello nokia") << true;
+ QTest::newRow("BasicAndTo") << QUrl("mailto:test@nokia.com?to=test2@nokia.com") << true;
+
QTest::newRow("BasicAndCc") << QUrl("mailto:test@nokia.com?cc=mycc@address.com") << true;
- QTest::newRow("BasicAndBcc") << QUrl("mailto:test@nokia.com?bcc=mybcc@address.com") << true;
- QTest::newRow("BasicAndBody") << QUrl("mailto:test@nokia.com?body=Test email message body") << true;
-
+ QTest::newRow("BasicAndBcc") << QUrl("mailto:test@nokia.com?bcc=mybcc@address.com") << true;
+ QTest::newRow("BasicAndBody") << QUrl("mailto:test@nokia.com?body=Test email message body") << true;
+
// RFC examples, these are actually invalid because there is not host defined
// Check that user is notified about invalid URL in mail application
QTest::newRow("RFC2368 Example 1") << QUrl::fromEncoded("mailto:addr1%2C%20addr2") << true;
QTest::newRow("RFC2368 Example 2") << QUrl::fromEncoded("mailto:?to=addr1%2C%20addr2") << true;
QTest::newRow("RFC2368 Example 3") << QUrl("mailto:addr1?to=addr2") << true;
-
- QTest::newRow("RFC2368 Example 4") << QUrl("mailto:joe@example.com?cc=bob@example.com&body=hello") << true;
+
+ QTest::newRow("RFC2368 Example 4") << QUrl("mailto:joe@example.com?cc=bob@example.com&body=hello") << true;
QTest::newRow("RFC2368 Example 5") << QUrl("mailto:?to=joe@example.com&cc=bob@example.com&body=hello") << true;
QTest::newRow("RFC2368 Example 6") << QUrl("mailto:foobar@example.com?In-Reply-To=%3c3469A91.D10AF4C@example.com") << true; // OpaqueData
QTest::newRow("RFC2368 Example 7") << QUrl::fromEncoded("mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index") << true;
QTest::newRow("RFC2368 Example 8") << QUrl::fromEncoded("mailto:infobot@example.com?body=send%20current-issue") << true;
QTest::newRow("RFC2368 Example 9") << QUrl("mailto:infobot@example.com?subject=current-issue") << true;
QTest::newRow("RFC2368 Example 10") << QUrl("mailto:chris@example.com") << true;
-
+
//QTest::newRow("RFC2368 Example 11 - illegal chars") << QUrl("mailto:joe@example.com?cc=bob@example.com?body=hello") << false;
QTest::newRow("RFC2368 Example 12") << QUrl::fromEncoded("mailto:gorby%25kremvax@example.com") << true; // encoded reserved chars '%'
- QTest::newRow("RFC2368 Example 13") << QUrl::fromEncoded("mailto:unlikely%3Faddress@example.com?blat=foop") << true; // encoded reserved chars `?'
+ QTest::newRow("RFC2368 Example 13") << QUrl::fromEncoded("mailto:unlikely%3Faddress@example.com?blat=foop") << true; // encoded reserved chars `?'
}
void tst_qdesktopservices::openMailtoUrl()
{
-#ifndef RUN_MANUAL_TESTS
- QSKIP("Test disabled -- only for manual purposes", SkipAll);
-#endif
-
- QFETCH(QUrl, url);
- QFETCH(bool, result);
- QCOMPARE(QDesktopServices::openUrl(url), result);
+#ifndef RUN_MANUAL_TESTS
+ QSKIP("Test disabled -- only for manual purposes", SkipAll);
+#endif
+
+ QFETCH(QUrl, url);
+ QFETCH(bool, result);
+ QCOMPARE(QDesktopServices::openUrl(url), result);
}
void tst_qdesktopservices::openFileUrl_data()
{
QTest::addColumn<QUrl>("url");
- QTest::addColumn<bool>("result");
-
+ QTest::addColumn<bool>("result");
+
// Text files
- QTest::newRow("DOS text file") << QUrl("file:///c:/data/others/dosfile.txt") << true;
- QTest::newRow("No EOF text file") << QUrl("file:///c:/data/others/noendofline.txt") << true;
+ QTest::newRow("DOS text file") << QUrl("file:///c:/data/others/dosfile.txt") << true;
+ QTest::newRow("No EOF text file") << QUrl("file:///c:/data/others/noendofline.txt") << true;
QTest::newRow("text file") << QUrl("file:///c:/data/others/testfile.txt") << true;
- QTest::newRow("text file with space") << QUrl("file:///c:/data/others/test file.txt") << true;
-
+ QTest::newRow("text file with space") << QUrl("file:///c:/data/others/test file.txt") << true;
+
// Images
- QTest::newRow("BMP image") << QUrl("file:///c:/data/images/image.bmp") << true;
- QTest::newRow("GIF image") << QUrl("file:///c:/data/images/image.gif") << true;
- QTest::newRow("JPG image") << QUrl("file:///c:/data/images/image.jpg") << true;
- QTest::newRow("PNG image") << QUrl("file:///c:/data/images/image.png") << true;
-
- // Audio
- QTest::newRow("MP4 audio") << QUrl("file:///c:/data/sounds/aac-only.mp4") << true;
- QTest::newRow("3GP audio") << QUrl("file:///c:/data/sounds/audio_3gpp.3gp") << true;
-
- // Video
- QTest::newRow("MP4 video") << QUrl("file:///c:/data/videos/vid-mpeg4-22k.mp4") << true;
-
- // Installs
- QTest::newRow("SISX") << QUrl("file:///c:/data/installs/ErrRd.sisx") << true;
-
- // Errors
- QTest::newRow("File does not exist") << QUrl("file:///c:/thisfileneverexists.txt") << false;
+ QTest::newRow("BMP image") << QUrl("file:///c:/data/images/image.bmp") << true;
+ QTest::newRow("GIF image") << QUrl("file:///c:/data/images/image.gif") << true;
+ QTest::newRow("JPG image") << QUrl("file:///c:/data/images/image.jpg") << true;
+ QTest::newRow("PNG image") << QUrl("file:///c:/data/images/image.png") << true;
+
+ // Audio
+ QTest::newRow("MP4 audio") << QUrl("file:///c:/data/sounds/aac-only.mp4") << true;
+ QTest::newRow("3GP audio") << QUrl("file:///c:/data/sounds/audio_3gpp.3gp") << true;
+
+ // Video
+ QTest::newRow("MP4 video") << QUrl("file:///c:/data/videos/vid-mpeg4-22k.mp4") << true;
+
+ // Installs
+ QTest::newRow("SISX") << QUrl("file:///c:/data/installs/ErrRd.sisx") << true;
+
+ // Errors
+ QTest::newRow("File does not exist") << QUrl("file:///c:/thisfileneverexists.txt") << false;
}
void tst_qdesktopservices::openFileUrl()
{
-#ifndef RUN_MANUAL_TESTS
- QSKIP("Test disabled -- only for manual purposes", SkipAll);
-#endif
-
- QFETCH(QUrl, url);
- QFETCH(bool, result);
+#ifndef RUN_MANUAL_TESTS
+ QSKIP("Test disabled -- only for manual purposes", SkipAll);
+#endif
+
+ QFETCH(QUrl, url);
+ QFETCH(bool, result);
QCOMPARE(QDesktopServices::openUrl(url), result);
- QTest::qWait(15000);
+ QTest::qWait(15000);
}
#endif
@@ -297,11 +297,11 @@ void tst_qdesktopservices::storageLocation()
QString storageLocation = QDesktopServices::storageLocation(location);
QString displayName = QDesktopServices::displayName(location);
//qDebug( "displayName: %s", displayName );
-
+
storageLocation = storageLocation.toLower();
displayName = displayName.toLower();
-
- QString drive = QDir::currentPath().left(2).toLower();
+
+ QString drive = QDir::currentPath().left(2).toLower();
if( drive == "z:" )
drive = "c:";
@@ -319,9 +319,9 @@ void tst_qdesktopservices::storageLocation()
case QDesktopServices::ApplicationsLocation:
#ifdef Q_CC_NOKIAX86
QCOMPARE( storageLocation, QString("z:/sys/bin") );
-#else
- QCOMPARE( storageLocation, drive + QString("/sys/bin") );
-#endif
+#else
+ QCOMPARE( storageLocation, drive + QString("/sys/bin") );
+#endif
break;
case QDesktopServices::MusicLocation:
QCOMPARE( storageLocation, drive + QString("/data/sounds") );
@@ -331,7 +331,7 @@ void tst_qdesktopservices::storageLocation()
break;
case QDesktopServices::PicturesLocation:
QCOMPARE( storageLocation, drive + QString("/data/images") );
- break;
+ break;
case QDesktopServices::TempLocation:
QCOMPARE( storageLocation, QDir::tempPath().toLower());
break;
@@ -339,18 +339,18 @@ void tst_qdesktopservices::storageLocation()
QCOMPARE( storageLocation, QDir::homePath().toLower());
break;
case QDesktopServices::DataLocation:
- // Just check the folder not the drive
+ // Just check the folder not the drive
QCOMPARE( storageLocation.mid(2), QDir::currentPath().mid(2).toLower());
- break;
+ break;
default:
QCOMPARE( storageLocation, QString() );
- break;
+ break;
}
#else
QDesktopServices::storageLocation(location);
QDesktopServices::displayName(location);
-#endif
+#endif
}