[Ktutorial-commits] SF.net SVN: ktutorial:[334] trunk/ktutorial/ktutorial-editor
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2011-07-07 10:31:23
|
Revision: 334 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=334&view=rev Author: danxuliu Date: 2011-07-07 10:31:17 +0000 (Thu, 07 Jul 2011) Log Message: ----------- Set the object name completion as case insensitive. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/view/RemoteObjectNameWidget.cpp trunk/ktutorial/ktutorial-editor/tests/unit/view/RemoteObjectNameWidgetTest.cpp Modified: trunk/ktutorial/ktutorial-editor/src/view/RemoteObjectNameWidget.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/RemoteObjectNameWidget.cpp 2011-07-07 02:31:41 UTC (rev 333) +++ trunk/ktutorial/ktutorial-editor/src/view/RemoteObjectNameWidget.cpp 2011-07-07 10:31:17 UTC (rev 334) @@ -123,6 +123,7 @@ KCompletion* completion = new RemoteObjectNameCompletion(mRemoteObjectNameRegister); completion->setOrder(KCompletion::Sorted); + completion->setIgnoreCase(true); ui->objectNameLineEdit->setCompletionObject(completion); ui->objectNameLineEdit->setAutoDeleteCompletionObject(true); Modified: trunk/ktutorial/ktutorial-editor/tests/unit/view/RemoteObjectNameWidgetTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/view/RemoteObjectNameWidgetTest.cpp 2011-07-07 02:31:41 UTC (rev 333) +++ trunk/ktutorial/ktutorial-editor/tests/unit/view/RemoteObjectNameWidgetTest.cpp 2011-07-07 10:31:17 UTC (rev 334) @@ -59,6 +59,7 @@ void testSetChosenRemoteObject(); void testSetChosenRemoteObjectWithNameNotUnique(); + void testNameCompletion(); void testDuplicatedNameCompletion(); void testTargetApplicationStartedAfterWidget(); @@ -247,6 +248,35 @@ assertRemoteObjectSignal(remoteObjectChosenSpy, 2, remoteObject); } +void RemoteObjectNameWidgetTest::testNameCompletion() { + TargetApplication::self()->setTargetApplicationFilePath(mPath); + TargetApplication::self()->start(); + + //Give the target application time to start + QTest::qWait(1000); + + RemoteObjectNameWidget widget; + + KCompletion* completion = objectNameLineEdit(&widget)->completionObject(); + QCOMPARE(completion->order(), KCompletion::Sorted); + + QStringList completionItems = completion->allMatches("The object name 42"); + QCOMPARE(completionItems.count(), 5); + QCOMPARE(completionItems[0], QString("The object name 42")); + QCOMPARE(completionItems[1], QString("The object name 420")); + QCOMPARE(completionItems[2], QString("The object name 421")); + QCOMPARE(completionItems[3], QString("The object name 422")); + QCOMPARE(completionItems[4], QString("The object name 423")); + + completionItems = completion->allMatches("the Object Name 42"); + QCOMPARE(completionItems.count(), 5); + QCOMPARE(completionItems[0], QString("The object name 42")); + QCOMPARE(completionItems[1], QString("The object name 420")); + QCOMPARE(completionItems[2], QString("The object name 421")); + QCOMPARE(completionItems[3], QString("The object name 422")); + QCOMPARE(completionItems[4], QString("The object name 423")); +} + void RemoteObjectNameWidgetTest::testDuplicatedNameCompletion() { TargetApplication::self()->setTargetApplicationFilePath(mPath); TargetApplication::self()->start(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |