Make QTranslator testcase independent of Widgets

There isn't really a need for the dependency as LanguageChange events can be
caught in QObject::eventFilter, directly.

Change-Id: I39778fbe1663924d97705b514ae399cfd3749776
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
bb10
João Abecasis 2012-03-22 01:38:48 +01:00 committed by Qt by Nokia
parent a30ee4598f
commit 2e92714090
2 changed files with 7 additions and 9 deletions

View File

@ -1,6 +1,6 @@
CONFIG += testcase
CONFIG += testcase parallel_test
TARGET = tst_qtranslator
QT += widgets testlib
QT = core testlib
SOURCES = tst_qtranslator.cpp
RESOURCES += qtranslator.qrc

View File

@ -40,18 +40,17 @@
****************************************************************************/
#include <QtTest/QtTest>
#include <QWidget>
#include <qtranslator.h>
#include <qfile.h>
class tst_QTranslator : public QWidget
class tst_QTranslator : public QObject
{
Q_OBJECT
public:
tst_QTranslator();
protected:
bool event(QEvent *event);
bool eventFilter(QObject *obj, QEvent *event);
private slots:
void initTestCase();
@ -71,8 +70,7 @@ private:
tst_QTranslator::tst_QTranslator()
: languageChangeEventCounter(0)
{
show();
hide();
qApp->installEventFilter(this);
}
void tst_QTranslator::initTestCase()
@ -83,11 +81,11 @@ void tst_QTranslator::initTestCase()
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
}
bool tst_QTranslator::event(QEvent *event)
bool tst_QTranslator::eventFilter(QObject *, QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
++languageChangeEventCounter;
return QWidget::event(event);
return false;
}
void tst_QTranslator::load()