summaryrefslogtreecommitdiffstats
path: root/kdeui/tests/kinputdialogtest.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdeui/tests/kinputdialogtest.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui/tests/kinputdialogtest.cpp')
-rw-r--r--kdeui/tests/kinputdialogtest.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/kdeui/tests/kinputdialogtest.cpp b/kdeui/tests/kinputdialogtest.cpp
new file mode 100644
index 000000000..3f9509a40
--- /dev/null
+++ b/kdeui/tests/kinputdialogtest.cpp
@@ -0,0 +1,67 @@
+/*
+ * Author: Nadeem Hasan <nhasan@kde.org>
+ * License: GPL V2
+ */
+
+#include <kapplication.h>
+#include <kinputdialog.h>
+#include <kdebug.h>
+
+#include <qstring.h>
+#include <qvalidator.h>
+
+int main( int argc, char *argv[] )
+{
+ KApplication app( argc, argv, "kinputdialogtest" );
+
+ bool ok;
+ QString svalue;
+ int ivalue;
+ double dvalue;
+
+ svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok );
+ kdDebug() << "value1: " << svalue << ", ok: " << ok << endl;
+
+ svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok, 0L, 0L,
+ &QRegExpValidator( QRegExp( "[0-9]{3}\\-[0-9]{3}\\-[0-9]{4}" ), 0L ) );
+ kdDebug() << "value2: " << svalue << ", ok: " << ok << endl;
+
+ svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok, 0L, 0L,
+ 0L, "900.900.900.900" );
+ kdDebug() << "value1: " << svalue << ", ok: " << ok << endl;
+
+ ivalue = KInputDialog::getInteger( "_caption", "_label:", 64, 0, 255,
+ 16, 16, &ok );
+ kdDebug() << "value3: " << ivalue << ", ok: " << ok << endl;
+
+ ivalue = KInputDialog::getInteger( "_caption", "_label:", 100, 0, 255,
+ 10, 10, &ok );
+ kdDebug() << "value4: " << ivalue << ", ok: " << ok << endl;
+
+ dvalue = KInputDialog::getDouble( "_caption", "_label:", 10, 0, 100, 0.1,
+ 2, &ok );
+ kdDebug() << "value5: " << dvalue << ", ok: " << ok << endl;
+
+ dvalue = KInputDialog::getDouble( "_caption", "_label:", 10, 0, 100, 2, &ok );
+ kdDebug() << "value6: " << dvalue << ", ok: " << ok << endl;
+
+ QStringList list, slvalue;
+ list << "Item 1" << "Item 2" << "Item 3" << "Item 4" << "Item 5";
+ svalue = KInputDialog::getItem( "_caption", "_label:", list, 1, false, &ok );
+ kdDebug() << "value7: " << svalue << ", ok: " << ok << endl;
+
+ svalue = KInputDialog::getItem( "_caption", "_label:", list, 1, true, &ok );
+ kdDebug() << "value8: " << svalue << ", ok: " << ok << endl;
+
+ QStringList select;
+ select << "Item 3";
+ list << "Item 6" << "Item 7" << "Item 8" << "Item 9" << "Item 10";
+ slvalue = KInputDialog::getItemList( "_caption", "_label:", list, select,
+ false, &ok );
+ kdDebug() << "value9: " << slvalue << ", ok: " << ok << endl;
+
+ select << "Item 5";
+ slvalue = KInputDialog::getItemList( "_caption", "_label:", list, select,
+ true, &ok );
+ kdDebug() << "value10: " << slvalue << ", ok: " << ok << endl;
+}