diff options
Diffstat (limited to 'kjsembed/tests/test_kio.js')
-rwxr-xr-x | kjsembed/tests/test_kio.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/kjsembed/tests/test_kio.js b/kjsembed/tests/test_kio.js new file mode 100755 index 00000000..11bd6a1c --- /dev/null +++ b/kjsembed/tests/test_kio.js @@ -0,0 +1,26 @@ +#!/usr/bin/env kjscmd + +var net = new NetAccess( this, 'net' ); + +var loc = '/tmp/test.jpg'; + +var ret = net.download( 'http://www.kde.org/media/images/kde_logo.jpg', loc ); + +if ( ret ) { + var mime = net.mimetype( loc ); + print( "Mimetype = " + mime + '\n' ); + var img = new Image(); + img.load( loc ); + if ( !img.isOk() ) { + warn( 'Failed to load image '+loc); + return; + } else { + print( 'Image ' + loc + ' is OK \n' ); + } + var lbl = new QLabel(this); + lbl.pixmap = img.pixmap(); + lbl.show(); +} + +net.del( loc ); +application.exec(); |