summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart.pngbin12424 -> 12577 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200.pngbin7943 -> 8063 bytes
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/image.pngbin0 -> 173 bytes
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/reset.qml9
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp13
-rw-r--r--tests/auto/qapplication/modal/main.cpp1
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp39
-rw-r--r--tests/auto/qinputcontext/qinputcontext.pro2
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp141
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp8
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp32
-rw-r--r--tests/auto/symbian/orientationchange/orientationchange.pro1
-rw-r--r--tests/auto/symbian/orientationchange/tst_orientationchange.cpp43
13 files changed, 245 insertions, 44 deletions
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart.png b/tests/auto/declarative/qdeclarativeimage/data/heart.png
index ff93f6c..abe97fe 100644
--- a/tests/auto/declarative/qdeclarativeimage/data/heart.png
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200.png b/tests/auto/declarative/qdeclarativeimage/data/heart200.png
index 5a31ae8..7fbb13c 100644
--- a/tests/auto/declarative/qdeclarativeimage/data/heart200.png
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart200.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativestates/data/image.png b/tests/auto/declarative/qdeclarativestates/data/image.png
new file mode 100644
index 0000000..ed1833c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativestates/data/image.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativestates/data/reset.qml b/tests/auto/declarative/qdeclarativestates/data/reset.qml
index 8799c97..a140ffa 100644
--- a/tests/auto/declarative/qdeclarativestates/data/reset.qml
+++ b/tests/auto/declarative/qdeclarativestates/data/reset.qml
@@ -3,17 +3,16 @@ import QtQuick 1.0
Rectangle {
width: 640
height: 480
- Text {
- id: theText
+ Image {
+ id: image
width: 40
- wrapMode: Text.WordWrap
- text: "a text string that is longer than 40 pixels"
+ source: "image.png"
}
states: State {
name: "state1"
PropertyChanges {
- target: theText
+ target: image
width: undefined
}
}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index b8409a5..870842c 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -44,7 +44,6 @@
#include <private/qdeclarativeanchors_p_p.h>
#include <private/qdeclarativerectangle_p.h>
#include <private/qdeclarativeimage_p.h>
-#include <private/qdeclarativetext_p.h>
#include <private/qdeclarativepropertychanges_p.h>
#include <private/qdeclarativestategroup_p.h>
#include <private/qdeclarativeitem_p.h>
@@ -1126,15 +1125,15 @@ void tst_qdeclarativestates::reset()
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
QVERIFY(rect != 0);
- QDeclarativeText *text = rect->findChild<QDeclarativeText*>();
- QVERIFY(text != 0);
- QCOMPARE(text->width(), qreal(40.));
- QVERIFY(text->width() < text->height());
+ QDeclarativeImage *image = rect->findChild<QDeclarativeImage*>();
+ QVERIFY(image != 0);
+ QCOMPARE(image->width(), qreal(40.));
+ QCOMPARE(image->height(), qreal(20.));
QDeclarativeItemPrivate::get(rect)->setState("state1");
- QVERIFY(text->width() > 41);
- QVERIFY(text->width() > text->height());
+ QCOMPARE(image->width(), 20.0);
+ QCOMPARE(image->height(), qreal(20.));
}
void tst_qdeclarativestates::illegalObjectCreation()
diff --git a/tests/auto/qapplication/modal/main.cpp b/tests/auto/qapplication/modal/main.cpp
index f9d8fb4..3eaaa0d 100644
--- a/tests/auto/qapplication/modal/main.cpp
+++ b/tests/auto/qapplication/modal/main.cpp
@@ -47,6 +47,7 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
+ QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774
base *b = new base();
return app.exec();
}
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 44f3504..6ea69a7 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -247,6 +247,7 @@ private slots:
void QTBUG_5859_exposedRect();
void QTBUG_7438_cursor();
void hoverLeave();
+ void QTBUG_16063_microFocusRect();
public slots:
void dummySlot() {}
@@ -4505,5 +4506,43 @@ void tst_QGraphicsView::hoverLeave()
QCOMPARE(item->leaveWidget, view.viewport());
}
+class IMItem : public QGraphicsRectItem
+{
+public:
+ IMItem(QGraphicsItem *parent = 0):
+ QGraphicsRectItem(QRectF(0, 0, 20, 20), parent)
+ {
+ setFlag(QGraphicsItem::ItemIsFocusable, true);
+ setFlag(QGraphicsItem::ItemAcceptsInputMethod, true);
+ }
+
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const
+ {
+ return mf;
+ }
+
+ static QRectF mf;
+};
+
+QRectF IMItem::mf(1.5, 1.6, 10, 10);
+
+void tst_QGraphicsView::QTBUG_16063_microFocusRect()
+{
+ QGraphicsScene scene;
+ IMItem *item = new IMItem();
+ scene.addItem(item);
+
+ QGraphicsView view(&scene);
+
+ view.setFixedSize(40, 40);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ scene.setFocusItem(item);
+ view.setFocus();
+ QRectF mfv = view.inputMethodQuery(Qt::ImMicroFocus).toRectF();
+ QCOMPARE(mfv, IMItem::mf.translated(-view.mapToScene(view.sceneRect().toRect()).boundingRect().topLeft()));
+}
+
QTEST_MAIN(tst_QGraphicsView)
#include "tst_qgraphicsview.moc"
diff --git a/tests/auto/qinputcontext/qinputcontext.pro b/tests/auto/qinputcontext/qinputcontext.pro
index ec6831e..4b3ab96 100644
--- a/tests/auto/qinputcontext/qinputcontext.pro
+++ b/tests/auto/qinputcontext/qinputcontext.pro
@@ -1,6 +1,8 @@
load(qttest_p4)
SOURCES += tst_qinputcontext.cpp
+contains(QT_CONFIG, webkit):QT += webkit
+
symbian {
LIBS += -lws32 -lcone
}
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
index 5a258a9..020f177 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -50,6 +50,13 @@
#include <qwindowsstyle.h>
#include <qdesktopwidget.h>
#include <qpushbutton.h>
+#include <qgraphicsview.h>
+#include <qgraphicsscene.h>
+
+#ifdef QT_WEBKIT_LIB
+#include <qwebview.h>
+#include <qgraphicswebview.h>
+#endif
#ifdef Q_OS_SYMBIAN
#include <private/qt_s60_p.h>
@@ -466,6 +473,115 @@ void tst_QInputContext::focusProxy()
QCOMPARE(gic->focusWidget(), &proxy);
}
+#ifdef QT_WEBKIT_LIB
+class AutoWebView : public QWebView
+{
+ Q_OBJECT
+
+public:
+ AutoWebView()
+ : m_length(0)
+ , m_mode(QLineEdit::Normal)
+ {
+ updatePage();
+ }
+ ~AutoWebView() {}
+
+ void updatePage()
+ {
+ // The update might reset the input method parameters.
+ bool imEnabled = testAttribute(Qt::WA_InputMethodEnabled);
+ Qt::InputMethodHints hints = inputMethodHints();
+
+ QString page = "<html><body onLoad=\"document.forms.testform.testinput.focus()\">"
+ "<form name=\"testform\"><input name=\"testinput\" type=\"%1\" %2></form></body></html>";
+ if (m_mode == QLineEdit::Password)
+ page = page.arg("password");
+ else
+ page = page.arg("text");
+
+ if (m_length == 0)
+ page = page.arg("");
+ else
+ page = page.arg("maxlength=\"" + QString::number(m_length) + "\"");
+
+ setHtml(page);
+
+ setAttribute(Qt::WA_InputMethodEnabled, imEnabled);
+ setInputMethodHints(hints);
+ }
+ void setMaxLength(int length)
+ {
+ m_length = length;
+ updatePage();
+ }
+ void setEchoMode(QLineEdit::EchoMode mode)
+ {
+ m_mode = mode;
+ updatePage();
+ }
+
+ int m_length;
+ QLineEdit::EchoMode m_mode;
+};
+
+class AutoGraphicsWebView : public QGraphicsView
+{
+ Q_OBJECT
+
+public:
+ AutoGraphicsWebView()
+ : m_length(0)
+ , m_mode(QLineEdit::Normal)
+ {
+ m_scene.addItem(&m_view);
+ setScene(&m_scene);
+ m_view.setFocus();
+ updatePage();
+ }
+ ~AutoGraphicsWebView() {}
+
+ void updatePage()
+ {
+ // The update might reset the input method parameters.
+ bool imEnabled = testAttribute(Qt::WA_InputMethodEnabled);
+ Qt::InputMethodHints hints = inputMethodHints();
+
+ QString page = "<html><body onLoad=\"document.forms.testform.testinput.focus()\">"
+ "<form name=\"testform\"><input name=\"testinput\" type=\"%1\" %2></form></body></html>";
+ if (m_mode == QLineEdit::Password)
+ page = page.arg("password");
+ else
+ page = page.arg("text");
+
+ if (m_length == 0)
+ page = page.arg("");
+ else
+ page = page.arg("maxlength=\"" + QString::number(m_length) + "\"");
+
+ m_view.setHtml(page);
+
+ setAttribute(Qt::WA_InputMethodEnabled, imEnabled);
+ setInputMethodHints(hints);
+ }
+ void setMaxLength(int length)
+ {
+ m_length = length;
+ updatePage();
+ }
+ void setEchoMode(QLineEdit::EchoMode mode)
+ {
+ m_mode = mode;
+ updatePage();
+ }
+
+ int m_length;
+ QLineEdit::EchoMode m_mode;
+ QGraphicsScene m_scene;
+ QGraphicsWebView m_view;
+};
+#endif // QT_WEBKIT_LIB
+
void tst_QInputContext::symbianTestCoeFepInputContext_data()
{
#ifdef Q_OS_SYMBIAN
@@ -481,6 +597,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data()
symbianTestCoeFepInputContext_addData<QLineEdit>();
symbianTestCoeFepInputContext_addData<QPlainTextEdit>();
symbianTestCoeFepInputContext_addData<QTextEdit>();
+# ifdef QT_WEBKIT_LIB
+ symbianTestCoeFepInputContext_addData<AutoWebView>();
+ symbianTestCoeFepInputContext_addData<AutoGraphicsWebView>();
+# endif
#endif
}
@@ -1087,13 +1207,28 @@ void tst_QInputContext::symbianTestCoeFepInputContext()
editwidget->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled);
editwidget->setInputMethodHints(inputMethodHints);
- QLineEdit *lineedit = qobject_cast<QLineEdit *>(editwidget);
- if (lineedit) {
+ if (QLineEdit *lineedit = qobject_cast<QLineEdit *>(editwidget)) {
if (maxLength > 0)
lineedit->setMaxLength(maxLength);
lineedit->setEchoMode(echoMode);
+#ifdef QT_WEBKIT_LIB
+ } else if (AutoWebView *webView = qobject_cast<AutoWebView *>(editwidget)) {
+ if (maxLength > 0)
+ webView->setMaxLength(maxLength);
+ webView->setEchoMode(echoMode);
+ // WebKit disables T9 everywhere.
+ if (inputMethodEnabled && !(inputMethodHints & Qt::ImhNoPredictiveText))
+ return;
+ } else if (AutoGraphicsWebView *webView = qobject_cast<AutoGraphicsWebView *>(editwidget)) {
+ if (maxLength > 0)
+ webView->setMaxLength(maxLength);
+ webView->setEchoMode(echoMode);
+ // WebKit disables T9 everywhere.
+ if (inputMethodEnabled && !(inputMethodHints & Qt::ImhNoPredictiveText))
+ return;
+#endif
} else if (maxLength > 0 || echoMode != QLineEdit::Normal) {
- // Only QLineEdits support these features so don't attempt any tests using those
+ // Only some widgets support these features so don't attempt any tests using those
// on other widgets.
return;
}
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp
index a497b13..9c4d134 100644
--- a/tests/auto/qprocess/tst_qprocess.cpp
+++ b/tests/auto/qprocess/tst_qprocess.cpp
@@ -2002,11 +2002,15 @@ void tst_QProcess::spaceInName()
void tst_QProcess::lockupsInStartDetached()
{
#if !defined(Q_OS_SYMBIAN)
- // What exactly is this call supposed to achieve anyway?
+ // Check that QProcess doesn't cause a lock up at this program's
+ // exit if a thread was started and we tried to run a program that
+ // doesn't exist. Before Qt 4.2, this used to lock up on Unix due
+ // to calling ::exit instead of ::_exit if execve failed.
+
QHostInfo::lookupHost(QString("something.invalid"), 0, 0);
-#endif
QProcess::execute("yjhbrty");
QProcess::startDetached("yjhbrty");
+#endif
}
//-----------------------------------------------------------------------------
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 7d1adec..de86bb7 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -10019,28 +10019,6 @@ void tst_QWidget::openModal_taskQTBUG_5804()
}
#ifdef Q_OS_SYMBIAN
-
-static CEikButtonGroupContainer* cba()
-{
- CEikButtonGroupContainer *oldCba = NULL;
-
- // Due to convoluted/buggy implementation of MEikAppUiFactory interface in Symbian,
- // the only way to get the correct cba is to use SwapButtonGroup function.
- // Calling SwapButtonGroup doesn't trigger anything, it only changes the value of iToolbar
- // member variable, so this double switching should not cause any interference for test.
- QT_TRAP_THROWING(
- CEikButtonGroupContainer *dummyCba = CEikButtonGroupContainer::NewL(
- CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, NULL, 0);
-
- oldCba = CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(dummyCba);
- CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(oldCba);
-
- delete dummyCba;
- )
-
- return oldCba;
-}
-
void tst_QWidget::cbaVisibility()
{
// Test case for task 261048
@@ -10073,7 +10051,7 @@ void tst_QWidget::cbaVisibility()
// Verify window decorations i.e. status pane and CBA are visible.
CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
QVERIFY(statusPane->IsVisible());
- CEikButtonGroupContainer* buttonGroup = cba();
+ CEikButtonGroupContainer* buttonGroup = CEikButtonGroupContainer::Current();
QVERIFY(buttonGroup->IsVisible());
}
@@ -10090,7 +10068,7 @@ void tst_QWidget::fullScreenWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = cba();
+ CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current();
//Enter
widget.showNormal();
@@ -10144,7 +10122,7 @@ void tst_QWidget::maximizedWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = cba();
+ CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current();
//Enter
widget.showNormal();
@@ -10200,7 +10178,7 @@ void tst_QWidget::minimizedWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = cba();
+ CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current();
//Enter
widget.showNormal();
@@ -10256,7 +10234,7 @@ void tst_QWidget::normalWindowModeTransitions()
const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
- CEikButtonGroupContainer *buttonGroup = cba();
+ CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current();
//Enter
widget.showMaximized();
diff --git a/tests/auto/symbian/orientationchange/orientationchange.pro b/tests/auto/symbian/orientationchange/orientationchange.pro
index 08b34f9..98aa2ad 100644
--- a/tests/auto/symbian/orientationchange/orientationchange.pro
+++ b/tests/auto/symbian/orientationchange/orientationchange.pro
@@ -4,4 +4,5 @@ SOURCES += tst_orientationchange.cpp
symbian {
INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+ LIBS += -lcone -leikcore -lavkon # Screen orientation
}
diff --git a/tests/auto/symbian/orientationchange/tst_orientationchange.cpp b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp
index eb3709d..2ac2f7f 100644
--- a/tests/auto/symbian/orientationchange/tst_orientationchange.cpp
+++ b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp
@@ -45,6 +45,8 @@
#include <eikenv.h>
#include <aknappui.h>
+#include <private/qcore_symbian_p.h>
+#include <QDesktopWidget>
class tst_orientationchange : public QObject
{
@@ -151,6 +153,47 @@ void tst_orientationchange::resizeEventOnOrientationChange()
}
QCOMPARE(normalWidget->resizeEventCount, 0);
+ QDesktopWidget desktop;
+ QRect qtAvail = desktop.availableGeometry(normalWidget);
+ TRect clientRect = static_cast<CEikAppUi*>(CCoeEnv::Static()-> AppUi())->ClientRect();
+ QRect symbianAvail = qt_TRect2QRect(clientRect);
+ QCOMPARE(qtAvail, symbianAvail);
+
+ // Switch orientation back to original
+ orientation = orientation == CAknAppUi::EAppUiOrientationPortrait
+ ? CAknAppUi::EAppUiOrientationLandscape
+ : CAknAppUi::EAppUiOrientationPortrait;
+
+
+ fullScreenWidget->reset();
+ maximizedWidget->reset();
+ normalWidget->reset();
+
+ TRAP(err, appUi->SetOrientationL(orientation));
+
+ QCoreApplication::sendPostedEvents();
+ QCoreApplication::sendPostedEvents();
+
+ // setOrientationL is not guaranteed to change orientation
+ // (if emulator configured to support just portrait or landscape, then
+ // setOrientationL call shouldn't do anything).
+ // So let's ensure that we do not get resize event twice.
+
+ QVERIFY(fullScreenWidget->resizeEventCount <= 1);
+ if (fullScreenWidget->resizeEventCount) {
+ QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize);
+ }
+ QVERIFY(maximizedWidget->resizeEventCount <= 1);
+ if (fullScreenWidget->resizeEventCount) {
+ QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize);
+ }
+ QCOMPARE(normalWidget->resizeEventCount, 0);
+
+ qtAvail = desktop.availableGeometry(normalWidget);
+ clientRect = static_cast<CEikAppUi*>(CCoeEnv::Static()-> AppUi())->ClientRect();
+ symbianAvail = qt_TRect2QRect(clientRect);
+ QCOMPARE(qtAvail, symbianAvail);
+
TRAP(err, appUi->SetOrientationL(CAknAppUi::EAppUiOrientationUnspecified));
delete normalWidget;