diff options
author | Alexander Golubev <[email protected]> | 2016-12-21 01:09:27 +0300 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2017-01-29 02:48:50 +0100 |
commit | 86921d65c5c218a2c721d905a93885cf2fe9b7b7 (patch) | |
tree | 617bb19f28f8fbff084e9d58ada0e037edb861e1 /tdeio/tests/kmimetypetest.cpp | |
parent | de48b4a218391da82d8bb725e5b8cb3038155065 (diff) | |
download | tdelibs-86921d65c5c218a2c721d905a93885cf2fe9b7b7.tar.gz tdelibs-86921d65c5c218a2c721d905a93885cf2fe9b7b7.zip |
tdeio: add tests
Signed-off-by: Alexander Golubev <[email protected]>
(cherry picked from commit ed74769bfaae171809c0bc1a10a8ba0f6ff8895f)
Diffstat (limited to 'tdeio/tests/kmimetypetest.cpp')
-rw-r--r-- | tdeio/tests/kmimetypetest.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tdeio/tests/kmimetypetest.cpp b/tdeio/tests/kmimetypetest.cpp index 5d963c81c..631521c8a 100644 --- a/tdeio/tests/kmimetypetest.cpp +++ b/tdeio/tests/kmimetypetest.cpp @@ -36,6 +36,17 @@ static void checkIcon( const KURL& url, const TQString& expectedIcon ) } } +static void checkExtention( const TQString& fileName, const TQString& expectedExtention ) { + TQString ext; + KMimeType::diagnoseFileName(fileName, ext); + if ( ext == expectedExtention) { + tqDebug("extension of %s is '%s: OK'", fileName.latin1(), ext.latin1()); + } else { + tqDebug("extension of %s is '%s, expected %s!'", fileName.latin1(), ext.latin1(), expectedExtention.latin1()); + exit(1); + } +} + int main( int argc, char** argv ) { TDEInstance blah("kmimetypetest"); @@ -63,14 +74,8 @@ int main( int argc, char** argv ) checkIcon( "trash:/foo/", "folder" ); } - TQString pdf; - KMimeType::diagnoseFileName("foo.pdf", pdf); - tqDebug("extension: '%s'", pdf.latin1()); - assert(pdf == TQString("*.pdf")); - TQString ps; - KMimeType::diagnoseFileName("foo.ps", ps); - tqDebug("extension: '%s'", ps.latin1()); - assert(ps == TQString("*.ps")); + checkExtention(TQString::fromLatin1("foo.pdf"), TQString::fromLatin1("*.pdf")); + checkExtention(TQString::fromLatin1("foo.ps"), TQString::fromLatin1("*.ps")); return 0; } |