summaryrefslogtreecommitdiffstats
path: root/tdeio/tests/kmimetypetest.cpp
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2016-12-21 01:09:27 +0300
committerSlávek Banko <slavek.banko@axis.cz>2017-01-29 02:27:15 +0100
commited74769bfaae171809c0bc1a10a8ba0f6ff8895f (patch)
tree2be1a9e1f24c538b0f682e733794336f6fe54193 /tdeio/tests/kmimetypetest.cpp
parentd556a8752c0862aa2d84a105dc8ac41b61ba7824 (diff)
downloadtdelibs-ed74769bfaae171809c0bc1a10a8ba0f6ff8895f.tar.gz
tdelibs-ed74769bfaae171809c0bc1a10a8ba0f6ff8895f.zip
tdeio: add tests
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
Diffstat (limited to 'tdeio/tests/kmimetypetest.cpp')
-rw-r--r--tdeio/tests/kmimetypetest.cpp21
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;
}