summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2011-03-10 01:26:38 (GMT)
committerBea Lam <bea.lam@nokia.com>2011-03-10 01:26:38 (GMT)
commit5098b3cc1127a1a4cbd66d0eeea8f2ec5f625bb9 (patch)
tree6aada3a65df762506a8615abcaed7348b4186824
parent4320e48d4bdfb58e2b59e82cd2f5f1131af88b3e (diff)
downloadQt-5098b3cc1127a1a4cbd66d0eeea8f2ec5f625bb9.zip
Qt-5098b3cc1127a1a4cbd66d0eeea8f2ec5f625bb9.tar.gz
Qt-5098b3cc1127a1a4cbd66d0eeea8f2ec5f625bb9.tar.bz2
Fix failing tests
RTL text-related tests were failing on mac since QApplication::keyboardInputDirection() is not always initialized when the QApplication instance is created. Change-Id: Ifa7214ffb1941d824a9425015b38aa77366381bb Reviewed-by: Martin Jones
-rw-r--r--doc/src/snippets/declarative/states/statechangescript.qml1
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp4
4 files changed, 14 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/states/statechangescript.qml b/doc/src/snippets/declarative/states/statechangescript.qml
index b885137..f490a97 100644
--- a/doc/src/snippets/declarative/states/statechangescript.qml
+++ b/doc/src/snippets/declarative/states/statechangescript.qml
@@ -37,6 +37,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+import QtQuick 1.0
Item {
//! [state and transition]
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index b5dfba8..2d52642 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -602,6 +602,7 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft()
QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft);
QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2);
+#ifndef Q_OS_MAC // QTBUG-18040
// empty text with implicit alignment follows the system locale-based
// keyboard input direction from QApplication::keyboardInputDirection
text->setText("");
@@ -609,8 +610,11 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft()
QDeclarativeText::AlignLeft : QDeclarativeText::AlignRight);
text->setHAlign(QDeclarativeText::AlignRight);
QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight);
+#endif
+
delete canvas;
+#ifndef Q_OS_MAC // QTBUG-18040
// alignment of Text with no text set to it
QString componentStr = "import QtQuick 1.0\nText {}";
QDeclarativeComponent textComponent(&engine);
@@ -619,6 +623,7 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft()
QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ?
QDeclarativeText::AlignLeft : QDeclarativeText::AlignRight);
delete textObject;
+#endif
}
void tst_qdeclarativetext::verticalAlignment()
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 402c6cd..7aac76c 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -524,6 +524,7 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft()
QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft);
QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2);
+#ifndef Q_OS_MAC // QTBUG-18040
// empty text with implicit alignment follows the system locale-based
// keyboard input direction from QApplication::keyboardInputDirection
textEdit->setText("");
@@ -536,9 +537,11 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft()
textEdit->setHAlign(QDeclarativeTextEdit::AlignRight);
QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight);
QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2);
+#endif
delete canvas;
+#ifndef Q_OS_MAC // QTBUG-18040
// alignment of TextEdit with no text set to it
QString componentStr = "import QtQuick 1.0\nTextEdit {}";
QDeclarativeComponent textComponent(&engine);
@@ -547,6 +550,7 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft()
QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ?
QDeclarativeTextEdit::AlignLeft : QDeclarativeTextEdit::AlignRight);
delete textObject;
+#endif
}
void tst_qdeclarativetextedit::vAlign()
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 734f91f..796ac23 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -1111,6 +1111,7 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft()
QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft);
QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
+#ifndef Q_OS_MAC // QTBUG-18040
// empty text with implicit alignment follows the system locale-based
// keyboard input direction from QApplication::keyboardInputDirection
textInput->setText("");
@@ -1123,9 +1124,11 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft()
textInput->setHAlign(QDeclarativeTextInput::AlignRight);
QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight);
QVERIFY(-textInputPrivate->hscroll > canvas->width()/2);
+#endif
delete canvas;
+#ifndef Q_OS_MAC // QTBUG-18040
// alignment of TextInput with no text set to it
QString componentStr = "import QtQuick 1.0\nTextInput {}";
QDeclarativeComponent textComponent(&engine);
@@ -1134,6 +1137,7 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft()
QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ?
QDeclarativeTextInput::AlignLeft : QDeclarativeTextInput::AlignRight);
delete textObject;
+#endif
}
void tst_qdeclarativetextinput::positionAt()