diff options
-rw-r--r-- | mkspecs/features/testcase.prf | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qtranslator.cpp | 18 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 5 | ||||
-rw-r--r-- | src/imports/shaders/shadereffect.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qtranslator/i18n/hellotr_en.qm | bin | 0 -> 230 bytes | |||
-rw-r--r-- | tests/auto/qtranslator/tst_qtranslator.cpp | 40 |
6 files changed, 65 insertions, 6 deletions
diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index 7a7c9e3..eb0aa9f 100644 --- a/mkspecs/features/testcase.prf +++ b/mkspecs/features/testcase.prf @@ -38,6 +38,10 @@ embedded: check.commands += -qws # Allow for custom arguments to tests check.commands += $(TESTARGS) + +# If the test is marked as insignificant, discard the exit code +insignificant_test:check.commands = -$${check.commands} + QMAKE_EXTRA_TARGETS *= check !debug_and_release|build_pass { diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index dfc90e8..692c78c 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -408,13 +408,26 @@ bool QTranslator::load(const QString & filename, const QString & directory, Q_D(QTranslator); d->clear(); + QString fname = filename; QString prefix; if (QFileInfo(filename).isRelative()) { #ifdef Q_OS_SYMBIAN - if (directory.isEmpty()) + //TFindFile doesn't like path in the filename + QString dir(directory); + int slash = filename.lastIndexOf(QLatin1Char('/')); + slash = qMax(slash, filename.lastIndexOf(QLatin1Char('\\'))); + if (slash >=0) { + //so move the path component into the directory prefix + if (dir.isEmpty()) + dir = filename.left(slash + 1); + else + dir = dir + QLatin1Char('/') + filename.left(slash + 1); + fname = fname.mid(slash + 1); + } + if (dir.isEmpty()) prefix = QCoreApplication::applicationDirPath(); else - prefix = QFileInfo(directory).absoluteFilePath(); //TFindFile doesn't like dirty paths + prefix = QFileInfo(dir).absoluteFilePath(); //TFindFile doesn't like dirty paths if (prefix.length() > 2 && prefix.at(1) == QLatin1Char(':') && prefix.at(0).isLetter()) prefix[0] = QLatin1Char('Y'); #else @@ -428,7 +441,6 @@ bool QTranslator::load(const QString & filename, const QString & directory, QString nativePrefix = QDir::toNativeSeparators(prefix); #endif - QString fname = filename; QString realname; QString delims; delims = search_delimiters.isNull() ? QString::fromLatin1("_.") : search_delimiters; diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 73e8eed..9ea0b83 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1157,7 +1157,6 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) { parentFocusScopeItem = fsi; p->d_ptr->focusScopeItem = 0; - fsi->d_ptr->focusScopeItemChange(false); } break; } @@ -1261,6 +1260,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q if (!inDestructor && (transformData || (newParent && newParent->d_ptr->transformData))) transformChanged(); + // Reparenting is finished, now safe to notify the previous focusScopeItem about changes + if (parentFocusScopeItem) + parentFocusScopeItem->d_ptr->focusScopeItemChange(false); + // Restore the sub focus chain. if (subFocusItem) { subFocusItem->d_ptr->setSubFocus(newParent); diff --git a/src/imports/shaders/shadereffect.cpp b/src/imports/shaders/shadereffect.cpp index f40d6b8..a5164e2 100644 --- a/src/imports/shaders/shadereffect.cpp +++ b/src/imports/shaders/shadereffect.cpp @@ -61,6 +61,7 @@ ShaderEffect::~ShaderEffect() void ShaderEffect::prepareBufferedDraw(QPainter *painter) { +#ifndef QT_NO_DYNAMIC_CAST // This workaround needed because QGraphicsEffect seems to always utilize default painters worldtransform // instead of the active painters worldtransform. const ShaderEffectBuffer *effectBuffer = dynamic_cast<ShaderEffectBuffer*> (painter->device()); @@ -70,6 +71,9 @@ void ShaderEffect::prepareBufferedDraw(QPainter *painter) } else { savedWorldTransform = painter->worldTransform(); } +#else + Q_UNUSED(painter); +#endif } void ShaderEffect::draw (QPainter *painter) diff --git a/tests/auto/qtranslator/i18n/hellotr_en.qm b/tests/auto/qtranslator/i18n/hellotr_en.qm Binary files differnew file mode 100644 index 0000000..cc42afe --- /dev/null +++ b/tests/auto/qtranslator/i18n/hellotr_en.qm diff --git a/tests/auto/qtranslator/tst_qtranslator.cpp b/tests/auto/qtranslator/tst_qtranslator.cpp index 8e2ed15..6f65e6a 100644 --- a/tests/auto/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/qtranslator/tst_qtranslator.cpp @@ -66,6 +66,10 @@ protected: private slots: void load(); void load2(); + void loadSubdir(); + void loadSubdir2(); + void loadSubdir3(); + void loadSubdir4(); void threadLoad(); void testLanguageChange(); void plural(); @@ -124,6 +128,38 @@ void tst_QTranslator::load2() QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); } +void tst_QTranslator::loadSubdir() +{ + QTranslator tor( 0 ); + tor.load("hellotr_en_GB", "i18n"); + QVERIFY(!tor.isEmpty()); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); +} + +void tst_QTranslator::loadSubdir2() +{ + QTranslator tor( 0 ); + tor.load("i18n/hellotr_en_GB"); + QVERIFY(!tor.isEmpty()); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); +} + +void tst_QTranslator::loadSubdir3() +{ + QTranslator tor( 0 ); + tor.load(QString(QLatin1String("i18n%1hellotr_en_GB")).arg(QDir::separator())); + QVERIFY(!tor.isEmpty()); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); +} + +void tst_QTranslator::loadSubdir4() +{ + QTranslator tor( 0 ); + tor.load("./hellotr_en_GB", "i18n"); + QVERIFY(!tor.isEmpty()); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); +} + class TranslatorThread : public QThread { void run() { @@ -249,10 +285,10 @@ void tst_QTranslator::loadFromResource() void tst_QTranslator::loadDirectory() { - QVERIFY(QFileInfo("../qtranslator").isDir()); + QVERIFY(QFileInfo("i18n").isDir()); QTranslator tor; - tor.load("qtranslator", ".."); + tor.load("qtranslator", "i18n"); QVERIFY(tor.isEmpty()); } |