summaryrefslogtreecommitdiffstats
path: root/kutils/tests
diff options
context:
space:
mode:
Diffstat (limited to 'kutils/tests')
-rw-r--r--kutils/tests/Makefile.am16
-rw-r--r--kutils/tests/kfindtest.cpp122
-rw-r--r--kutils/tests/kfindtest.h10
-rw-r--r--kutils/tests/kreplacetest.cpp192
-rw-r--r--kutils/tests/kreplacetest.h10
5 files changed, 175 insertions, 175 deletions
diff --git a/kutils/tests/Makefile.am b/kutils/tests/Makefile.am
index 747b2af2d..3bde7a9a2 100644
--- a/kutils/tests/Makefile.am
+++ b/kutils/tests/Makefile.am
@@ -1,16 +1,16 @@
INCLUDES = $(all_includes)
-check_PROGRAMS = ktqfindtest ktqreplacetest
+check_PROGRAMS = kfindtest kreplacetest
-TESTS = ktqfindtest ktqreplacetest
+TESTS = kfindtest kreplacetest
-ktqfindtest_SOURCES = ktqfindtest.cpp
-ktqfindtest_LDADD = ../libkutils.la
-ktqfindtest_LDFLAGS = $(all_libraries)
+kfindtest_SOURCES = kfindtest.cpp
+kfindtest_LDADD = ../libkutils.la
+kfindtest_LDFLAGS = $(all_libraries)
-ktqreplacetest_SOURCES = ktqreplacetest.cpp
-ktqreplacetest_LDADD = ../libkutils.la
-ktqreplacetest_LDFLAGS = $(all_libraries)
+kreplacetest_SOURCES = kreplacetest.cpp
+kreplacetest_LDADD = ../libkutils.la
+kreplacetest_LDFLAGS = $(all_libraries)
METASOURCES = AUTO
diff --git a/kutils/tests/kfindtest.cpp b/kutils/tests/kfindtest.cpp
index 5db237a89..1652eb625 100644
--- a/kutils/tests/kfindtest.cpp
+++ b/kutils/tests/kfindtest.cpp
@@ -17,9 +17,9 @@
Boston, MA 02110-1301, USA.
*/
-#include "../ktqfind.h"
-#include "../ktqfinddialog.h"
-#include "ktqfindtest.h"
+#include "../kfind.h"
+#include "../kfinddialog.h"
+#include "kfindtest.h"
#include <kapplication.h>
#include <kcmdlineargs.h>
@@ -47,21 +47,21 @@ static bool check(TQString txt, TQString a, TQString b) // from kurltest
void KFindTest::changeText(uint line, const TQString &text)
{
Q_ASSERT(line < m_text.count());
- Q_ASSERT(m_tqfind != 0);
+ Q_ASSERT(m_find != 0);
m_line = line;
m_text[line] = text;
- m_tqfind->setData(line, text);
+ m_find->setData(line, text);
}
-void KFindTest::tqfind(const TQString &pattern, long options)
+void KFindTest::find(const TQString &pattern, long options)
{
- delete m_tqfind;
- m_tqfind = new KFind(pattern, options, 0);
+ delete m_find;
+ m_find = new KFind(pattern, options, 0);
- connect(m_tqfind, TQT_SIGNAL(highlight(const TQString &, int, int)),
+ connect(m_find, TQT_SIGNAL(highlight(const TQString &, int, int)),
TQT_SLOT(slotHighlight(const TQString &, int, int)));
- connect(m_tqfind, TQT_SIGNAL(highlight(int, int, int)),
+ connect(m_find, TQT_SIGNAL(highlight(int, int, int)),
TQT_SLOT(slotHighlight(int, int, int)));
m_line = 0;
@@ -69,23 +69,23 @@ void KFindTest::tqfind(const TQString &pattern, long options)
do
{
if(options & KFindDialog::FindIncremental)
- m_tqfind->setData(m_line, m_text[m_line]);
+ m_find->setData(m_line, m_text[m_line]);
else
- m_tqfind->setData(m_text[m_line]);
+ m_find->setData(m_text[m_line]);
m_line++;
- result = m_tqfind->tqfind();
+ result = m_find->find();
} while(result == KFind::NoMatch && m_line < m_text.count());
}
-void KFindTest::tqfindNext(const TQString &pattern)
+void KFindTest::findNext(const TQString &pattern)
{
- Q_ASSERT(m_tqfind != 0);
+ Q_ASSERT(m_find != 0);
if(!pattern.isNull())
{
- m_tqfind->setPattern(pattern);
+ m_find->setPattern(pattern);
}
KFind::Result result = KFind::NoMatch;
@@ -93,20 +93,20 @@ void KFindTest::tqfindNext(const TQString &pattern)
{
//kdDebug() << "m_line: " << m_line << endl;
- result = m_tqfind->tqfind();
+ result = m_find->find();
if(result == KFind::NoMatch && m_line < m_text.count())
{
//kdDebug() << "incrementing m_line..." << endl;
- if(m_tqfind->options() & KFindDialog::FindIncremental)
- m_tqfind->setData(m_line, m_text[m_line]);
+ if(m_find->options() & KFindDialog::FindIncremental)
+ m_find->setData(m_line, m_text[m_line]);
else
- m_tqfind->setData(m_text[m_line]);
+ m_find->setData(m_text[m_line]);
m_line++;
}
} while(result == KFind::NoMatch && m_line < m_text.count());
- //kdDebug() << "tqfind next completed" << m_line << endl;
+ //kdDebug() << "find next completed" << m_line << endl;
}
void KFindTest::slotHighlight(const TQString &text, int index, int matchedLength)
@@ -123,7 +123,7 @@ void KFindTest::slotHighlight(int id, int index, int matchedLength)
int main(int argc, char **argv)
{
- KCmdLineArgs::init(argc, argv, "ktqfindtest", "KFindTest", 0, 0, false);
+ KCmdLineArgs::init(argc, argv, "kfindtest", "KFindTest", 0, 0, false);
KApplication app;
TQString text = "This file is part of the KDE project.\n"
@@ -183,13 +183,13 @@ int main(int argc, char **argv)
kdDebug() << "Plain static search..." << endl;
- // first we do a simple text searching the text and doing a few tqfind nexts
- test->tqfind("This", 0);
- test->tqfindNext();
- test->tqfindNext();
- test->tqfindNext();
- test->tqfindNext();
- test->tqfindNext();
+ // first we do a simple text searching the text and doing a few find nexts
+ test->find("This", 0);
+ test->findNext();
+ test->findNext();
+ test->findNext();
+ test->findNext();
+ test->findNext();
check("result", test->hits().join(""), output1);
test->clearHits();
@@ -198,20 +198,20 @@ int main(int argc, char **argv)
kdDebug() << "FindIncremental with static contents..." << endl;
// now we'll do some searches using FindIncremental
- test->tqfind("", KFindDialog::FindIncremental);
- test->tqfindNext("i");
- test->tqfindNext("is");
- test->tqfindNext("ist");
- test->tqfindNext();
- test->tqfindNext("istri");
- test->tqfindNext("istr");
- test->tqfindNext("ist");
- test->tqfindNext("is");
- test->tqfindNext("W");
- test->tqfindNext("WA");
- test->tqfindNext("WARRANTY");
- test->tqfindNext("Free");
- test->tqfindNext("Software Foundation");
+ test->find("", KFindDialog::FindIncremental);
+ test->findNext("i");
+ test->findNext("is");
+ test->findNext("ist");
+ test->findNext();
+ test->findNext("istri");
+ test->findNext("istr");
+ test->findNext("ist");
+ test->findNext("is");
+ test->findNext("W");
+ test->findNext("WA");
+ test->findNext("WARRANTY");
+ test->findNext("Free");
+ test->findNext("Software Foundation");
check("result", test->hits().join(""), output2);
test->clearHits();
@@ -220,25 +220,25 @@ int main(int argc, char **argv)
kdDebug() << "FindIncremental with dynamic contents..." << endl;
// now do that again but with pages that change between searches
- test->tqfind("", KFindDialog::FindIncremental);
- test->tqfindNext("i");
- test->tqfindNext("is");
- test->tqfindNext("ist");
- test->tqfindNext("istr");
- test->tqfindNext();
+ test->find("", KFindDialog::FindIncremental);
+ test->findNext("i");
+ test->findNext("is");
+ test->findNext("ist");
+ test->findNext("istr");
+ test->findNext();
test->changeText(1, "The second line now looks a whole lot different.");
- test->tqfindNext("istri");
- test->tqfindNext("istr");
- test->tqfindNext("ist");
- test->tqfindNext("is");
- test->tqfindNext("i");
- test->tqfindNext("W");
- test->tqfindNext("WA");
- test->tqfindNext("WARRANTY");
+ test->findNext("istri");
+ test->findNext("istr");
+ test->findNext("ist");
+ test->findNext("is");
+ test->findNext("i");
+ test->findNext("W");
+ test->findNext("WA");
+ test->findNext("WARRANTY");
test->changeText(6, " but WITHOUT ANY xxxx; without even the implied warranty of");
- test->tqfindNext("WARRAN");
- test->tqfindNext("Free");
- test->tqfindNext("Software Foundation");
+ test->findNext("WARRAN");
+ test->findNext("Free");
+ test->findNext("Software Foundation");
check("result", test->hits().join(""), output3);
test->clearHits();
@@ -249,4 +249,4 @@ int main(int argc, char **argv)
return 0;
}
-#include "ktqfindtest.moc"
+#include "kfindtest.moc"
diff --git a/kutils/tests/kfindtest.h b/kutils/tests/kfindtest.h
index 254215217..b3be84a8b 100644
--- a/kutils/tests/kfindtest.h
+++ b/kutils/tests/kfindtest.h
@@ -25,20 +25,20 @@
class KFind;
-class KFindTest : public TQObject
+class KFindTest : public QObject
{
Q_OBJECT
public:
KFindTest(const TQStringList &text) :
TQObject(0),
- m_tqfind(0),
+ m_find(0),
m_text(text),
m_line(0)
{}
- void tqfind(const TQString &pattern, long options = 0);
- void tqfindNext(const TQString &pattern = TQString::null);
+ void find(const TQString &pattern, long options = 0);
+ void findNext(const TQString &pattern = TQString::null);
void changeText(uint line, const TQString &text);
@@ -50,7 +50,7 @@ class KFindTest : public TQObject
void slotHighlight(int id, int index, int matchedLengthlength);
private:
- KFind *m_tqfind;
+ KFind *m_find;
TQStringList m_text;
uint m_line;
TQStringList m_hits;
diff --git a/kutils/tests/kreplacetest.cpp b/kutils/tests/kreplacetest.cpp
index e12474b43..a810b7706 100644
--- a/kutils/tests/kreplacetest.cpp
+++ b/kutils/tests/kreplacetest.cpp
@@ -23,44 +23,44 @@
#include <kapplication.h>
#include <tqeventloop.h>
#include <kpushbutton.h>
-#include "../ktqreplace.h"
-#include "../ktqreplacedialog.h"
+#include "../kreplace.h"
+#include "../kreplacedialog.h"
-#include "ktqreplacetest.h"
+#include "kreplacetest.h"
#include <kdebug.h>
#include <stdlib.h>
-void KReplaceTest::tqreplace( const TQString &pattern, const TQString &tqreplacement, long options )
+void KReplaceTest::replace( const TQString &pattern, const TQString &replacement, long options )
{
m_needEventLoop = false;
- // This creates a tqreplace-next-prompt dialog if needed.
- m_tqreplace = new KReplace(pattern, tqreplacement, options);
+ // This creates a replace-next-prompt dialog if needed.
+ m_replace = new KReplace(pattern, replacement, options);
// Connect highlight signal to code which handles highlighting
// of found text.
- connect(m_tqreplace, TQT_SIGNAL( highlight( const TQString &, int, int ) ),
+ connect(m_replace, TQT_SIGNAL( highlight( const TQString &, int, int ) ),
this, TQT_SLOT( slotHighlight( const TQString &, int, int ) ) );
- // Connect tqfindNext signal - called when pressing the button in the dialog
- connect(m_tqreplace, TQT_SIGNAL( tqfindNext() ),
+ // Connect findNext signal - called when pressing the button in the dialog
+ connect(m_replace, TQT_SIGNAL( findNext() ),
this, TQT_SLOT( slotReplaceNext() ) );
- // Connect tqreplace signal - called when doing a tqreplacement
- connect(m_tqreplace, TQT_SIGNAL( tqreplace(const TQString &, int, int, int) ),
+ // Connect replace signal - called when doing a replacement
+ connect(m_replace, TQT_SIGNAL( replace(const TQString &, int, int, int) ),
this, TQT_SLOT( slotReplace(const TQString &, int, int, int) ) );
// Go to initial position
if ( (options & KReplaceDialog::FromCursor) == 0 )
{
- if ( m_tqreplace->options() & KFindDialog::FindBackwards )
+ if ( m_replace->options() & KFindDialog::FindBackwards )
m_currentPos = m_text.fromLast();
else
m_currentPos = m_text.begin();
}
- // Launch first tqreplacement
+ // Launch first replacement
slotReplaceNext();
if ( m_needEventLoop )
- tqApp->eventLoop()->enterLoop();
+ qApp->eventLoop()->enterLoop();
}
void KReplaceTest::slotHighlight( const TQString &str, int matchingIndex, int matchedLength )
@@ -72,17 +72,17 @@ void KReplaceTest::slotHighlight( const TQString &str, int matchingIndex, int ma
// animateClick triggers a timer, hence the enterloop/exitloop
// Calling slotReplace directly would lead to infinite loop anyway (Match never returned,
// so slotReplaceNext never returns)
- if ( m_tqreplace->options() & KReplaceDialog::PromptOnReplace ) {
- m_tqreplace->tqreplaceNextDialog( false )->actionButton( (KDialogBase::ButtonCode)m_button )->animateClick();
+ if ( m_replace->options() & KReplaceDialog::PromptOnReplace ) {
+ m_replace->replaceNextDialog( false )->actionButton( (KDialogBase::ButtonCode)m_button )->animateClick();
m_needEventLoop = true;
}
}
-void KReplaceTest::slotReplace(const TQString &text, int tqreplacementIndex, int tqreplacedLength, int matchedLength)
+void KReplaceTest::slotReplace(const TQString &text, int replacementIndex, int replacedLength, int matchedLength)
{
- kdDebug() << "slotReplace index=" << tqreplacementIndex << " tqreplacedLength=" << tqreplacedLength << " matchedLength=" << matchedLength << " text=" << text.left( 50 ) << endl;
- *m_currentPos = text; // KReplace hacked the tqreplacement into 'text' in already.
+ kdDebug() << "slotReplace index=" << replacementIndex << " replacedLength=" << replacedLength << " matchedLength=" << matchedLength << " text=" << text.left( 50 ) << endl;
+ *m_currentPos = text; // KReplace hacked the replacement into 'text' in already.
}
void KReplaceTest::slotReplaceNext()
@@ -90,14 +90,14 @@ void KReplaceTest::slotReplaceNext()
//kdDebug() << k_funcinfo << endl;
KFind::Result res = KFind::NoMatch;
while ( res == KFind::NoMatch && m_currentPos != m_text.end() ) {
- if ( m_tqreplace->needData() )
- m_tqreplace->setData( *m_currentPos );
+ if ( m_replace->needData() )
+ m_replace->setData( *m_currentPos );
// Let KReplace inspect the text fragment, and display a dialog if a match is found
- res = m_tqreplace->tqreplace();
+ res = m_replace->replace();
if ( res == KFind::NoMatch ) {
- if ( m_tqreplace->options() & KFindDialog::FindBackwards )
+ if ( m_replace->options() & KFindDialog::FindBackwards )
m_currentPos--;
else
m_currentPos++;
@@ -106,8 +106,8 @@ void KReplaceTest::slotReplaceNext()
#if 0 // commented out so that this test doesn't require interaction
if ( res == KFind::NoMatch ) // i.e. at end
- if ( m_tqreplace->shouldRestart() ) {
- if ( m_tqreplace->options() & KFindDialog::FindBackwards )
+ if ( m_replace->shouldRestart() ) {
+ if ( m_replace->options() & KFindDialog::FindBackwards )
m_currentPos = m_text.fromLast();
else
m_currentPos = m_text.begin();
@@ -115,7 +115,7 @@ void KReplaceTest::slotReplaceNext()
}
#endif
if ( res == KFind::NoMatch && m_needEventLoop )
- tqApp->eventLoop()->exitLoop();
+ qApp->eventLoop()->exitLoop();
}
void KReplaceTest::print()
@@ -126,16 +126,16 @@ void KReplaceTest::print()
}
/* button is the button that we emulate pressing, when options includes PromptOnReplace.
- Valid possibilities are User1 (tqreplace all) and User3 (tqreplace) */
+ Valid possibilities are User1 (replace all) and User3 (replace) */
static void testReplaceSimple( int options, int button = 0 )
{
kdDebug() << "testReplaceSimple: " << options << endl;
KReplaceTest test( TQString( "hellohello" ), button );
- test.tqreplace( "hello", "HELLO", options );
+ test.replace( "hello", "HELLO", options );
TQStringList textLines = test.textLines();
assert( textLines.count() == 1 );
if ( textLines[ 0 ] != "HELLOHELLO" ) {
- kdError() << "ASSERT FAILED: tqreplaced text is '" << textLines[ 0 ] << "' instead of 'HELLOHELLO'" << endl;
+ kdError() << "ASSERT FAILED: replaced text is '" << textLines[ 0 ] << "' instead of 'HELLOHELLO'" << endl;
exit(1);
}
}
@@ -146,11 +146,11 @@ static void testReplaceBlank( int options, int button = 0 )
{
kdDebug() << "testReplaceBlank: " << options << endl;
KReplaceTest test( TQString( "aaaaaa" ), button );
- test.tqreplace( "a", "", options );
+ test.replace( "a", "", options );
TQStringList textLines = test.textLines();
assert( textLines.count() == 1 );
if ( !textLines[ 0 ].isEmpty() ) {
- kdError() << "ASSERT FAILED: tqreplaced text is '" << textLines[ 0 ] << "' instead of ''" << endl;
+ kdError() << "ASSERT FAILED: replaced text is '" << textLines[ 0 ] << "' instead of ''" << endl;
exit(1);
}
}
@@ -161,11 +161,11 @@ static void testReplaceBlankSearch( int options, int button = 0 )
{
kdDebug() << "testReplaceBlankSearch: " << options << endl;
KReplaceTest test( TQString( "bbbb" ), button );
- test.tqreplace( "", "foo", options );
+ test.replace( "", "foo", options );
TQStringList textLines = test.textLines();
assert( textLines.count() == 1 );
if ( textLines[ 0 ] != "foobfoobfoobfoobfoo" ) {
- kdError() << "ASSERT FAILED: tqreplaced text is '" << textLines[ 0 ] << "' instead of 'foobfoobfoobfoobfoo'" << endl;
+ kdError() << "ASSERT FAILED: replaced text is '" << textLines[ 0 ] << "' instead of 'foobfoobfoobfoobfoo'" << endl;
exit(1);
}
}
@@ -173,13 +173,13 @@ static void testReplaceBlankSearch( int options, int button = 0 )
static void testReplaceLonger( int options, int button = 0 )
{
kdDebug() << "testReplaceLonger: " << options << endl;
- // Standard test of a tqreplacement string longer than the matched string
+ // Standard test of a replacement string longer than the matched string
KReplaceTest test( TQString( "aaaa" ), button );
- test.tqreplace( "a", "bb", options );
+ test.replace( "a", "bb", options );
TQStringList textLines = test.textLines();
assert( textLines.count() == 1 );
if ( textLines[ 0 ] != "bbbbbbbb" ) {
- kdError() << "ASSERT FAILED: tqreplaced text is '" << textLines[ 0 ] << "' instead of 'bbbbbbbb'" << endl;
+ kdError() << "ASSERT FAILED: replaced text is '" << textLines[ 0 ] << "' instead of 'bbbbbbbb'" << endl;
exit(1);
}
}
@@ -187,13 +187,13 @@ static void testReplaceLonger( int options, int button = 0 )
static void testReplaceLongerInclude( int options, int button = 0 )
{
kdDebug() << "testReplaceLongerInclude: " << options << endl;
- // Similar test, where the tqreplacement string includes the search string
+ // Similar test, where the replacement string includes the search string
KReplaceTest test( TQString( "a foo b" ), button );
- test.tqreplace( "foo", "foobar", options );
+ test.replace( "foo", "foobar", options );
TQStringList textLines = test.textLines();
assert( textLines.count() == 1 );
if ( textLines[ 0 ] != "a foobar b" ) {
- kdError() << "ASSERT FAILED: tqreplaced text is '" << textLines[ 0 ] << "' instead of 'a foobar b'" << endl;
+ kdError() << "ASSERT FAILED: replaced text is '" << textLines[ 0 ] << "' instead of 'a foobar b'" << endl;
exit(1);
}
}
@@ -201,13 +201,13 @@ static void testReplaceLongerInclude( int options, int button = 0 )
static void testReplaceLongerInclude2( int options, int button = 0 )
{
kdDebug() << "testReplaceLongerInclude2: " << options << endl;
- // Similar test, but with more chances of matches inside the tqreplacement string
+ // Similar test, but with more chances of matches inside the replacement string
KReplaceTest test( TQString( "aaaa" ), button );
- test.tqreplace( "a", "aa", options );
+ test.replace( "a", "aa", options );
TQStringList textLines = test.textLines();
assert( textLines.count() == 1 );
if ( textLines[ 0 ] != "aaaaaaaa" ) {
- kdError() << "ASSERT FAILED: tqreplaced text is '" << textLines[ 0 ] << "' instead of 'aaaaaaaa'" << endl;
+ kdError() << "ASSERT FAILED: replaced text is '" << textLines[ 0 ] << "' instead of 'aaaaaaaa'" << endl;
exit(1);
}
}
@@ -217,99 +217,99 @@ static void testReplaceBackRef( int options, int button = 0 )
{
kdDebug() << "testReplaceBackRef: " << options << endl;
KReplaceTest test( TQString( "abc def" ), button );
- test.tqreplace( "abc", "(\\0)", options );
+ test.replace( "abc", "(\\0)", options );
TQStringList textLines = test.textLines();
assert( textLines.count() == 1 );
TQString expected = options & KReplaceDialog::BackReference ? "(abc) def" : "(\\0) def";
if ( textLines[ 0 ] != expected ) {
- kdError() << "ASSERT FAILED: tqreplaced text is '" << textLines[ 0 ] << "' instead of '"<< expected << "'" << endl;
+ kdError() << "ASSERT FAILED: replaced text is '" << textLines[ 0 ] << "' instead of '"<< expected << "'" << endl;
exit(1);
}
}
-static void testReplacementHistory( const TQStringList& tqfindHistory, const TQStringList& tqreplaceHistory )
+static void testReplacementHistory( const TQStringList& findHistory, const TQStringList& replaceHistory )
{
- KReplaceDialog dlg( 0, 0, 0, tqfindHistory, tqreplaceHistory );
+ KReplaceDialog dlg( 0, 0, 0, findHistory, replaceHistory );
dlg.show();
- kdDebug() << "testReplacementHistory:" << dlg.tqreplacementHistory() << endl;
- assert( dlg.tqreplacementHistory() == tqreplaceHistory );
+ kdDebug() << "testReplacementHistory:" << dlg.replacementHistory() << endl;
+ assert( dlg.replacementHistory() == replaceHistory );
}
static void testReplacementHistory()
{
- TQStringList tqfindHistory;
- TQStringList tqreplaceHistory;
- tqfindHistory << "foo" << "bar";
- tqreplaceHistory << "FOO" << "BAR";
- testReplacementHistory( tqfindHistory, tqreplaceHistory );
-
- tqfindHistory.clear();
- tqreplaceHistory.clear();
- tqfindHistory << "foo" << "bar";
- tqreplaceHistory << TQString::null << "baz"; // #130831
- testReplacementHistory( tqfindHistory, tqreplaceHistory );
+ TQStringList findHistory;
+ TQStringList replaceHistory;
+ findHistory << "foo" << "bar";
+ replaceHistory << "FOO" << "BAR";
+ testReplacementHistory( findHistory, replaceHistory );
+
+ findHistory.clear();
+ replaceHistory.clear();
+ findHistory << "foo" << "bar";
+ replaceHistory << TQString::null << "baz"; // #130831
+ testReplacementHistory( findHistory, replaceHistory );
}
int main( int argc, char **argv )
{
- KCmdLineArgs::init(argc, argv, "ktqreplacetest", 0, 0);
+ KCmdLineArgs::init(argc, argv, "kreplacetest", 0, 0);
KApplication app;
testReplacementHistory(); // #130831
testReplaceBlank( 0 );
- testReplaceBlank( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceBlank( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceBlank( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceBlank( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceBlank( KReplaceDialog::FindBackwards, 0 );
- testReplaceBlank( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceBlank( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceBlank( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceBlank( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceBlankSearch( 0 );
- testReplaceBlankSearch( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceBlankSearch( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceBlankSearch( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceBlankSearch( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceBlankSearch( KReplaceDialog::FindBackwards, 0 );
- testReplaceBlankSearch( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceBlankSearch( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceBlankSearch( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceBlankSearch( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceSimple( 0 );
- testReplaceSimple( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceSimple( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceSimple( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceSimple( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceSimple( KReplaceDialog::FindBackwards, 0 );
- testReplaceSimple( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceSimple( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceSimple( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceSimple( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceLonger( 0 );
- testReplaceLonger( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceLonger( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceLonger( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceLonger( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceLonger( KReplaceDialog::FindBackwards, 0 );
- testReplaceLonger( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceLonger( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceLonger( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceLonger( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceLongerInclude( 0 );
- testReplaceLongerInclude( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceLongerInclude( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceLongerInclude( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceLongerInclude( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceLongerInclude( KReplaceDialog::FindBackwards, 0 );
- testReplaceLongerInclude( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceLongerInclude( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceLongerInclude( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceLongerInclude( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceLongerInclude2( 0 );
- testReplaceLongerInclude2( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceLongerInclude2( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceLongerInclude2( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceLongerInclude2( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceLongerInclude2( KReplaceDialog::FindBackwards, 0 );
- testReplaceLongerInclude2( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceLongerInclude2( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceLongerInclude2( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceLongerInclude2( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceBackRef( 0 );
- testReplaceBackRef( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceBackRef( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceBackRef( KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceBackRef( KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceBackRef( KReplaceDialog::FindBackwards, 0 );
- testReplaceBackRef( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceBackRef( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
- testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceBackRef( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceBackRef( KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
+ testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::FindBackwards, 0 );
- testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // tqreplace
- testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // tqreplace all
+ testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User3 ); // replace
+ testReplaceBackRef( KReplaceDialog::BackReference | KReplaceDialog::FindBackwards | KReplaceDialog::PromptOnReplace, KDialogBase::User1 ); // replace all
TQString text = "This file is part of the KDE project.\n"
"This library is free software; you can redistribute it and/or\n"
@@ -331,12 +331,12 @@ int main( int argc, char **argv )
"free";
KReplaceTest test( TQStringList::split( '\n', text, true ), 0 );
- test.tqreplace( "GNU", "KDE", 0 );
- test.tqreplace( "free", "*free*", 0 );
- test.tqreplace( "This", "THIS*", KFindDialog::FindBackwards );
+ test.replace( "GNU", "KDE", 0 );
+ test.replace( "free", "*free*", 0 );
+ test.replace( "This", "THIS*", KFindDialog::FindBackwards );
test.print();
//return app.exec();
return 0;
}
-#include "ktqreplacetest.moc"
+#include "kreplacetest.moc"
diff --git a/kutils/tests/kreplacetest.h b/kutils/tests/kreplacetest.h
index 4a4252849..ff85ca34b 100644
--- a/kutils/tests/kreplacetest.h
+++ b/kutils/tests/kreplacetest.h
@@ -25,26 +25,26 @@
class KReplace;
-class KReplaceTest : public TQObject
+class KReplaceTest : public QObject
{
Q_OBJECT
public:
KReplaceTest( const TQStringList& text, int button )
- : TQObject( 0L ), m_text( text ), m_tqreplace( 0 ), m_button( button ) {}
+ : TQObject( 0L ), m_text( text ), m_replace( 0 ), m_button( button ) {}
- void tqreplace( const TQString &pattern, const TQString &tqreplacement, long options );
+ void replace( const TQString &pattern, const TQString &replacement, long options );
void print();
const TQStringList& textLines() const { return m_text; }
public slots:
void slotHighlight( const TQString &, int, int );
void slotReplaceNext();
- void slotReplace(const TQString &text, int tqreplacementIndex, int tqreplacedLength, int matchedLength);
+ void slotReplace(const TQString &text, int replacementIndex, int replacedLength, int matchedLength);
private:
TQStringList::Iterator m_currentPos;
TQStringList m_text;
- KReplace* m_tqreplace;
+ KReplace* m_replace;
bool m_needEventLoop;
int m_button;
};