summaryrefslogtreecommitdiffstats
path: root/tdespell2/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tdespell2/tests')
-rw-r--r--tdespell2/tests/Makefile.am24
-rw-r--r--tdespell2/tests/backgroundtest.cpp167
-rw-r--r--tdespell2/tests/backgroundtest.h45
-rw-r--r--tdespell2/tests/test.cpp100
-rw-r--r--tdespell2/tests/test_config.cpp38
-rw-r--r--tdespell2/tests/test_configdialog.cpp40
-rw-r--r--tdespell2/tests/test_dialog.cpp65
-rw-r--r--tdespell2/tests/test_dialog.h42
-rw-r--r--tdespell2/tests/test_filter.cpp50
-rw-r--r--tdespell2/tests/test_highlighter.cpp41
10 files changed, 612 insertions, 0 deletions
diff --git a/tdespell2/tests/Makefile.am b/tdespell2/tests/Makefile.am
new file mode 100644
index 000000000..682ad272a
--- /dev/null
+++ b/tdespell2/tests/Makefile.am
@@ -0,0 +1,24 @@
+AM_CPPFLAGS = -DKDE_NO_COMPAT -DQT_NO_COMPAT -I$(top_srcdir)/tdespell2 -I$(top_srcdir)/tdespell2/ui $(all_includes)
+METASOURCES = AUTO
+
+
+check_PROGRAMS = test test_filter backgroundtest \
+ test_dialog test_highlighter test_configdialog
+
+test_SOURCES = test.cpp
+test_LDADD = ../ui/libtdespell2.la $(LIB_TDECORE)
+
+test_filter_SOURCES = test_filter.cpp
+test_filter_LDADD = ../ui/libtdespell2.la $(LIB_TDECORE)
+
+backgroundtest_SOURCES = backgroundtest.cpp
+backgroundtest_LDADD = ../ui/libtdespell2.la $(LIB_TDECORE)
+
+test_dialog_SOURCES = test_dialog.cpp
+test_dialog_LDADD = ../ui/libtdespell2.la $(LIB_TDECORE)
+
+test_highlighter_SOURCES = test_highlighter.cpp
+test_highlighter_LDADD = ../ui/libtdespell2_noinst.la ../libtdespell2base.la $(LIB_TDECORE) $(LIB_KPARTS) ../../tdeutils/libtdeutils.la
+
+test_configdialog_SOURCES = test_configdialog.cpp
+test_configdialog_LDADD = ../ui/libtdespell2_noinst.la ../libtdespell2base.la $(LIB_TDECORE) $(LIB_KPARTS) ../../tdeutils/libtdeutils.la
diff --git a/tdespell2/tests/backgroundtest.cpp b/tdespell2/tests/backgroundtest.cpp
new file mode 100644
index 000000000..aca02af53
--- /dev/null
+++ b/tdespell2/tests/backgroundtest.cpp
@@ -0,0 +1,167 @@
+/**
+ * backgroundtest.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "backgroundtest.h"
+#include "backgroundtest.moc"
+
+#include "broker.h"
+using namespace KSpell2;
+
+#include <kapplication.h>
+#include <kdebug.h>
+
+const char *text = "Rationale \
+========= \
+ \
+This code is intended to provide an implementation of the W3C's XPath \
+specification for KHTML. XPath isn't particularly useful on its own, however\
+it is an essential building block for the implementation of other standards \
+like XSLT and XQuery. XPath is supported to a greater or lesser extent by both\
+IE and Mozilla so it is likely to become increasingly important over the next\
+few years.\
+ \
+Why write another XPath implementation? \
+======================================= \
+ \
+The are already a number of XPath implementations available under free \
+licenses including Mozilla's, libxml2, Xerces and probably others, so it is \
+reasonable to ask why there should be another one. \
+ \
+It would certainly be possible to integrate one of these implementations into\
+KHTML, but it would actually be quite a lot of work. I looked at all of the\
+implementations mentioned with a view to using this approach before I decided\
+to start from scratch.\
+ \
+Mozilla XPath\
+-------------\
+ \
+Seems to be incomplete, and though the code was originally standalone it now\
+seems to be tied to the mozilla codebase quite tightly. This makes porting it\
+a lot of work, and makes working with the mozilla team on fixing bugs\
+etc. hard as the code bases would have diverged quite a lot.\
+ \
+Xerces XPath (C++ version)\
+--------------------------\
+ \
+The Xerces code seemed pretty clean and was reasonably understandable, however\
+it doesn't seem to be used very much which greatly reduces the utility. As\
+with the mozilla code, porting it to use KHTML's DOM would take a fair bit of \
+work. The main issue here being that Xerces is based around pointers to Nodes\
+rather than implicitly shared Node objects.\
+ \
+libxml2 \
+------- \
+ \
+This is the most obvious library to reuse as it is currently used to generate\
+the KDE documentation, and is also a very complete and fast\
+implementation. The down side of using this code is that it would either need\
+a new DOM implementation in KHTML (which used the libxml2 structures), a \
+wrapper library that made on of the DOM trees support the API of the other, or\
+binding layer that parsed the XML twice and somehow maintained a mapping\
+between the two DOM trees. Unfortunately the documentation of this library is\
+less than great, which would add to the problems.\
+ \
+The C++ wrappers to libxml2 are considerably closer to what I was looking\
+for. They are well documented and have a well structured API. Unfortunately\
+using this library still requires some mechanism to integrate the two\
+underlying DOM implementations.\
+ \
+KHTML XPath\
+----------- \
+ \
+There are some advantages to the XPath implementation Zack and I are working\
+on, namely: \
+ \
+- Ease of integration with the rest of kjs/tdehtml.\
+- Use of dom2 traversal (which will also be available to use directly).\
+- C++ rather than C and a wrapper (reducing the overheads).\
+- The code is clean and uses familiar types and idioms. \
+ \
+We intend the code to be build on top of the DOM api rather than tying it\
+directly to the Qt or KHTML XML implementations. This will allow us to take\
+advantage of any improvements that might be made to the underlying parser\
+etc. The DOM2 traversal APIs provide a set of classes that map almost directly \
+to the XPath location steps, since we need to implement these facilities\
+anyway writing the relatively small amount of code needed to support XPath\
+seems sensible.\
+ \
+Building \
+========\
+ \
+This code needs to live in a subdir off the tdehtml directory in tdelibs. The\
+subdir should be called 'xpath'. The easiest way to regenerate the makefiles\
+is to go to the root of the tdelibs tree and run: \
+ create_makefiles tdehtml/xpath\
+ \
+This code is intended to compile, but not to work.\
+ \
+Usage \
+===== \
+ \
+./test_xpath simple.xml\
+./test_values\
+./test_functions \
+ \
+Notes\
+===== \
+ \
+apidoc Duh! It's the docs \
+working Stuff that i'm mining for ideas\
+\
+Discussion\
+========== \
+ \
+If you want to talk about this code feel free to mail us.";
+
+BackgroundTest::BackgroundTest()
+ : TQObject( 0 )
+{
+ m_checker = new BackgroundChecker( Broker::openBroker(), this );
+ connect( m_checker, TQT_SIGNAL(done()),
+ TQT_SLOT(slotDone()) );
+ connect( m_checker, TQT_SIGNAL(misspelling(const TQString&, int)),
+ TQT_SLOT(slotMisspelling(const TQString&, int)) );
+ m_len = strlen( text );
+ m_checker->checkText( text );
+ m_timer.start();
+}
+
+void BackgroundTest::slotDone()
+{
+ kdDebug()<<"Text of length "<<m_len<<" checked in "
+ << m_timer.elapsed() << " msec."<<endl;
+ TQApplication::exit();
+}
+
+void BackgroundTest::slotMisspelling( const TQString& word, int start )
+{
+ kdDebug()<<"Misspelling \""<< word << "\" at " << start << endl;
+ m_checker->continueChecking();
+}
+
+
+int main( int argc, char** argv )
+{
+ TDEApplication app(argc, argv, "KSpell2Test");
+
+ BackgroundTest test;
+
+ return app.exec();
+}
diff --git a/tdespell2/tests/backgroundtest.h b/tdespell2/tests/backgroundtest.h
new file mode 100644
index 000000000..2f08e9ce0
--- /dev/null
+++ b/tdespell2/tests/backgroundtest.h
@@ -0,0 +1,45 @@
+/**
+ * backgroundtest.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef BACKGROUNDTEST_H
+#define BACKGROUNDTEST_H
+
+#include <tqobject.h>
+#include <tqdatetime.h>
+
+#include "backgroundchecker.h"
+
+class BackgroundTest : public TQObject
+{
+ Q_OBJECT
+public:
+ BackgroundTest();
+
+protected slots:
+ void slotDone();
+ void slotMisspelling( const TQString& word, int start );
+
+private:
+ KSpell2::BackgroundChecker *m_checker;
+ TQTime m_timer;
+ int m_len;
+};
+
+#endif
diff --git a/tdespell2/tests/test.cpp b/tdespell2/tests/test.cpp
new file mode 100644
index 000000000..e8ceabaf7
--- /dev/null
+++ b/tdespell2/tests/test.cpp
@@ -0,0 +1,100 @@
+/**
+ * test.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "broker.h"
+#include "dictionary.h"
+
+#include <kapplication.h>
+#include <kdebug.h>
+
+#include <tqdatetime.h>
+
+using namespace KSpell2;
+
+int main( int argc, char** argv )
+{
+ TDEApplication app(argc, argv, "KSpell2Test");
+
+ Broker::Ptr broker = Broker::openBroker();
+
+ kdDebug()<< "Clients are " << broker->clients() << endl;
+ kdDebug()<< "Languages are " << broker->languages() << endl;
+
+ Dictionary *dict = broker->dictionary( "en_US" );
+
+ TQStringList words;
+
+ words << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted"
+ << "hello" << "helo" << "enviroment" << "guvernment" << "farted";
+
+ TQTime mtime;
+ mtime.start();
+ for ( TQStringList::Iterator itr = words.begin(); itr != words.end(); ++itr ) {
+ if ( dict && !dict->check( *itr ) ) {
+ //kdDebug()<<"Word " << *itr <<" is misspelled"<<endl;
+ TQStringList sug = dict->suggest( *itr );
+ //kdDebug()<<"Suggestions : "<<sug<<endl;
+ }
+ }
+ //mtime.stop();
+ kdDebug()<<"Elapsed time is "<<mtime.elapsed()<<endl;
+
+ delete dict;
+
+ return 0;
+}
diff --git a/tdespell2/tests/test_config.cpp b/tdespell2/tests/test_config.cpp
new file mode 100644
index 000000000..2d243bd46
--- /dev/null
+++ b/tdespell2/tests/test_config.cpp
@@ -0,0 +1,38 @@
+/**
+ * test_config.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "configdialog.h"
+
+#include <kapplication.h>
+#include <kdebug.h>
+using namespace KSpell2;
+
+int main( int argc, char** argv )
+{
+ TDEApplication app(argc, argv, "KSpell2Test");
+
+ SettingsDialog *dialog = new SettingsDialog( 0 );
+
+ dialog->show();
+
+ app.setMainWidget( dialog );
+
+ return app.exec();
+}
diff --git a/tdespell2/tests/test_configdialog.cpp b/tdespell2/tests/test_configdialog.cpp
new file mode 100644
index 000000000..a9ff16cdd
--- /dev/null
+++ b/tdespell2/tests/test_configdialog.cpp
@@ -0,0 +1,40 @@
+/**
+ * test_configdialog.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "configdialog.h"
+#include "broker.h"
+
+#include <kapplication.h>
+#include <kdebug.h>
+using namespace KSpell2;
+
+int main( int argc, char** argv )
+{
+ TDEApplication app(argc, argv, "KSpell2Test");
+
+ Broker::Ptr broker = Broker::openBroker();
+ ConfigDialog *dialog = new ConfigDialog( broker, 0 );
+
+ dialog->show();
+
+ app.setMainWidget( dialog );
+
+ return app.exec();
+}
diff --git a/tdespell2/tests/test_dialog.cpp b/tdespell2/tests/test_dialog.cpp
new file mode 100644
index 000000000..19503e307
--- /dev/null
+++ b/tdespell2/tests/test_dialog.cpp
@@ -0,0 +1,65 @@
+/**
+ * test_dialog.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "test_dialog.h"
+#include "test_dialog.moc"
+
+#include "backgroundchecker.h"
+#include "dictionary.h"
+#include "filter.h"
+
+#include <kapplication.h>
+#include <kdebug.h>
+using namespace KSpell2;
+
+TestDialog::TestDialog()
+ : TQObject( 0, "testdialog" )
+{
+
+}
+
+void TestDialog::check( const TQString& buffer )
+{
+ KSpell2::Dialog *dlg = new KSpell2::Dialog(
+ new BackgroundChecker( Broker::openBroker(), this, "checker" ),
+ 0, "my dialog" );
+ connect( dlg, TQT_SIGNAL(done(const TQString&)),
+ TQT_SLOT(doneChecking(const TQString&)) );
+ dlg->setBuffer( buffer );
+ dlg->show();
+}
+
+void TestDialog::doneChecking( const TQString& buf )
+{
+ kdDebug()<<"Done with :"<<buf<<endl;
+ tqApp->quit();
+}
+
+int main( int argc, char** argv )
+{
+ TDEApplication app(argc, argv, "KSpell2Test");
+
+ TestDialog test;
+ test.check( "This is a sample buffer. Whih this thingg will "
+ "be checkin for misstakes. Whih, Enviroment, govermant. Whih."
+ );
+
+ return app.exec();
+}
diff --git a/tdespell2/tests/test_dialog.h b/tdespell2/tests/test_dialog.h
new file mode 100644
index 000000000..e8a6cf970
--- /dev/null
+++ b/tdespell2/tests/test_dialog.h
@@ -0,0 +1,42 @@
+/**
+ * test_dialog.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef TEST_DIALOG_H
+#define TEST_DIALOG_H
+
+#include "dialog.h"
+#include "broker.h"
+
+#include <tqobject.h>
+
+class TestDialog : public TQObject
+{
+ Q_OBJECT
+public:
+ TestDialog();
+
+public slots:
+ void check( const TQString& buffer );
+ void doneChecking( const TQString& );
+private:
+ KSpell2::Broker *m_broker;
+};
+
+#endif
diff --git a/tdespell2/tests/test_filter.cpp b/tdespell2/tests/test_filter.cpp
new file mode 100644
index 000000000..430f157dd
--- /dev/null
+++ b/tdespell2/tests/test_filter.cpp
@@ -0,0 +1,50 @@
+/**
+ * test_filter.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "filter.h"
+
+
+#include <kapplication.h>
+#include <kdebug.h>
+
+using namespace KSpell2;
+
+int main( int argc, char** argv )
+{
+ TDEApplication app(argc, argv, "Filter");
+
+ TQString buffer = TQString( "This is a sample buffer. Please test me." );
+
+ Filter filter;
+ filter.setBuffer( buffer );
+
+ Word w;
+
+ while ( ! (w=filter.nextWord()).end ) {
+ kdDebug()<< "Found word \""<< w.word << "\" which starts at position "
+ << w.start <<endl;
+ }
+
+ filter.setBuffer( buffer );
+
+
+
+ return 0;
+}
diff --git a/tdespell2/tests/test_highlighter.cpp b/tdespell2/tests/test_highlighter.cpp
new file mode 100644
index 000000000..c11972254
--- /dev/null
+++ b/tdespell2/tests/test_highlighter.cpp
@@ -0,0 +1,41 @@
+/**
+ * test_highlighter.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "highlighter.h"
+#include "dictionary.h"
+#include "filter.h"
+
+#include <kapplication.h>
+#include <kdebug.h>
+
+#include <tqtextedit.h>
+
+int main( int argc, char** argv )
+{
+ TDEApplication app(argc, argv, "KSpell2Test");
+
+ TQTextEdit *test = new TQTextEdit();
+ KSpell2::Highlighter *hl = new KSpell2::Highlighter( test );
+ Q_UNUSED( hl );
+ app.setMainWidget( test );
+ test->show();
+
+ return app.exec();
+}