diff options
Diffstat (limited to 'kutils/tests/kfindtest.cpp')
-rw-r--r-- | kutils/tests/kfindtest.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
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" |