summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/transitionAssignmentBug.qml12
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp13
-rw-r--r--tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml24
-rw-r--r--tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp17
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/qtbug_20648.qml7
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp21
-rw-r--r--tests/auto/lancelot/tst_lancelot.cpp21
-rw-r--r--tests/auto/qaudioinput/tst_qaudioinput.cpp133
-rw-r--r--tests/auto/qdialog/tst_qdialog.cpp16
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp2
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp7
-rw-r--r--tests/auto/qpushbutton/tst_qpushbutton.cpp31
-rw-r--r--tests/auto/qtextcursor/tst_qtextcursor.cpp18
14 files changed, 264 insertions, 68 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/transitionAssignmentBug.qml b/tests/auto/declarative/qdeclarativeanimations/data/transitionAssignmentBug.qml
new file mode 100644
index 0000000..99b9ac5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimations/data/transitionAssignmentBug.qml
@@ -0,0 +1,12 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 400
+ height: 400
+
+ property bool nullObject
+ Component.onCompleted: nullObject = transitions.length > 0 && transitions[0] === null
+
+ property list<Transition> myTransitions: [Transition {}, Transition {}]
+ transitions: myTransitions
+}
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index 00db2d4..5d90597 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -88,6 +88,7 @@ private slots:
void registrationBug();
void doubleRegistrationBug();
void alwaysRunToEndRestartBug();
+ void transitionAssignmentBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -844,6 +845,18 @@ void tst_qdeclarativeanimations::alwaysRunToEndRestartBug()
QCOMPARE(static_cast<QDeclarativeAbstractAnimation*>(&animation)->qtAnimation()->state(), QAbstractAnimation::Stopped);
}
+//QTBUG-20227
+void tst_qdeclarativeanimations::transitionAssignmentBug()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, SRCDIR "/data/transitionAssignmentBug.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QCOMPARE(rect->property("nullObject").toBool(), false);
+}
+
QTEST_MAIN(tst_qdeclarativeanimations)
#include "tst_qdeclarativeanimations.moc"
diff --git a/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml b/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml
new file mode 100644
index 0000000..ba4c9f6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativebinding/data/deletedObject.qml
@@ -0,0 +1,24 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: wrapper
+ width: 400
+ height: 400
+
+ property bool activateBinding: false
+
+ Binding {
+ id: binding
+ target: Qt.createQmlObject('import QtQuick 1.0; Item { property real value: 10 }', wrapper)
+ property: "value"
+ when: activateBinding
+ value: x + y
+ }
+
+ Component.onCompleted: binding.target.destroy();
+
+// MouseArea {
+// anchors.fill: parent
+// onClicked: activateBinding = true;
+// }
+}
diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
index 6305cd3..ca394b0 100644
--- a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
+++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
@@ -60,6 +60,7 @@ public:
private slots:
void binding();
void whenAfterValue();
+ void deletedObject();
private:
QDeclarativeEngine engine;
@@ -113,6 +114,22 @@ void tst_qdeclarativebinding::whenAfterValue()
delete rect;
}
+//QTBUG-20692
+void tst_qdeclarativebinding::deletedObject()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/deletedObject.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+
+ //don't crash
+ rect->setProperty("activateBinding", true);
+
+ delete rect;
+}
+
QTEST_MAIN(tst_qdeclarativebinding)
#include "tst_qdeclarativebinding.moc"
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_20648.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_20648.qml
new file mode 100644
index 0000000..40f21ef
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_20648.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+QtObject {
+ property bool hd: true
+
+ property real test: ((hd ? 100 : 20) + 0)
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 71214a3..bf7c9a4 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -177,6 +177,7 @@ private slots:
void aliasWritesOverrideBindings();
void pushCleanContext();
void realToInt();
+ void qtbug_20648();
void include();
@@ -3090,6 +3091,15 @@ void tst_qdeclarativeecmascript::realToInt()
QCOMPARE(object->value(), int(8));
}
+void tst_qdeclarativeecmascript::qtbug_20648()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("qtbug_20648.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toInt(), 100);
+ delete o;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 8530c7f..5d6f2a2 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -1679,15 +1679,26 @@ void tst_qdeclarativetextedit::cursorDelegate()
QInputMethodEvent event;
QApplication::sendEvent(view, &event);
+
// Test delegate gets moved on mouse press.
textEditObject->setSelectByMouse(true);
textEditObject->setCursorPosition(0);
- qDebug() << textEditObject->boundingRect() << textEditObject->positionToRectangle(5).center() << view->mapFromScene(textEditObject->positionToRectangle(5).center());
- QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(textEditObject->positionToRectangle(5).center()));
+ const QPoint point1 = view->mapFromScene(textEditObject->positionToRectangle(5).center());
+ QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, point1);
QVERIFY(textEditObject->cursorPosition() != 0);
QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
+ // Test delegate gets moved on mouse drag
+ textEditObject->setCursorPosition(0);
+ const QPoint point2 = view->mapFromScene(textEditObject->positionToRectangle(10).center());
+ QTest::mousePress(view->viewport(), Qt::LeftButton, 0, point1);
+ QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(view->viewport(), &mv);
+ QTest::mouseRelease(view->viewport(), Qt::LeftButton, 0, point2);
+ QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
+ QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
+
textEditObject->setReadOnly(true);
textEditObject->setCursorPosition(0);
QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(textEditObject->positionToRectangle(5).center()));
@@ -1696,6 +1707,12 @@ void tst_qdeclarativetextedit::cursorDelegate()
QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
textEditObject->setCursorPosition(0);
+ QTest::mouseClick(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(textEditObject->positionToRectangle(5).center()));
+ QVERIFY(textEditObject->cursorPosition() != 0);
+ QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
+ QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
+
+ textEditObject->setCursorPosition(0);
QCOMPARE(textEditObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textEditObject->cursorRectangle().y(), qRound(delegateObject->y()));
QVERIFY(textEditObject->cursorRectangle().y() >= 0);
diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp
index cba5fab..256ff29 100644
--- a/tests/auto/lancelot/tst_lancelot.cpp
+++ b/tests/auto/lancelot/tst_lancelot.cpp
@@ -62,6 +62,7 @@ public:
tst_Lancelot();
static bool simfail;
+ static PlatformInfo clientInfo;
private:
enum GraphicsEngine {
@@ -98,6 +99,7 @@ private slots:
};
bool tst_Lancelot::simfail = false;
+PlatformInfo tst_Lancelot::clientInfo;
tst_Lancelot::tst_Lancelot()
{
@@ -112,7 +114,7 @@ void tst_Lancelot::initTestCase()
#if defined(Q_OS_SOMEPLATFORM)
QSKIP("This test is not supported on this platform.", SkipAll);
#endif
- if (!proto.connect(QLatin1String("tst_Lancelot"), &dryRunMode))
+ if (!proto.connect(QLatin1String("tst_Lancelot"), &dryRunMode, clientInfo))
QSKIP(qPrintable(proto.errorMessage()), SkipAll);
#if defined(USE_RUNTIME_DIR)
@@ -329,13 +331,26 @@ QTEST_MAIN(tst_Lancelot)
int main(int argc, char *argv[])
{
+ tst_Lancelot::clientInfo = PlatformInfo::localHostInfo();
+
char *fargv[20];
int fargc = 0;
for (int i = 0; i < qMin(argc, 19); i++) {
- if (!qstrcmp(argv[i], "-simfail"))
+ if (!qstrcmp(argv[i], "-simfail")) {
tst_Lancelot::simfail = true;
- else
+ } else if (!qstrcmp(argv[i], "-compareto") && i < argc-1) {
+ QString arg = QString::fromLocal8Bit(argv[++i]);
+ int split = arg.indexOf(QLC('='));
+ if (split < 0)
+ continue;
+ QString key = arg.left(split).trimmed();
+ QString value = arg.mid(split+1).trimmed();
+ if (key.isEmpty() || value.isEmpty())
+ continue;
+ tst_Lancelot::clientInfo.addOverride(key, value);
+ } else {
fargv[fargc++] = argv[i];
+ }
}
fargv[fargc] = 0;
return rmain(fargc, fargv);
diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp
index 6025bdb..0004c42 100644
--- a/tests/auto/qaudioinput/tst_qaudioinput.cpp
+++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp
@@ -86,14 +86,14 @@ void tst_QAudioInput::initTestCase()
// Only perform tests if audio input device exists!
QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- if(devices.size() > 0)
+ if (devices.size() > 0)
available = true;
else {
qWarning()<<"NOTE: no audio input device found, no test will be performed";
available = false;
}
- if(available)
+ if (available)
audio = new QAudioInput(format, this);
}
@@ -124,6 +124,9 @@ void tst_QAudioInput::invalidFormat_data()
void tst_QAudioInput::invalidFormat()
{
+ if (!available)
+ QSKIP("No audio input device found, no test will be performed", SkipAll);
+
QFETCH(QAudioFormat, invalidFormat);
QAudioInput audioInput(invalidFormat, this);
@@ -140,81 +143,85 @@ void tst_QAudioInput::invalidFormat()
void tst_QAudioInput::settings()
{
- if(available) {
- // Confirm the setting we added in the init function.
- QAudioFormat f = audio->format();
-
- QVERIFY(format.channels() == f.channels());
- QVERIFY(format.frequency() == f.frequency());
- QVERIFY(format.sampleSize() == f.sampleSize());
- QVERIFY(format.codec() == f.codec());
- QVERIFY(format.byteOrder() == f.byteOrder());
- QVERIFY(format.sampleType() == f.sampleType());
- }
+ if (!available)
+ QSKIP("No audio input device found, no test will be performed", SkipAll);
+
+ // Confirm the setting we added in the init function.
+ QAudioFormat f = audio->format();
+
+ QVERIFY(format.channels() == f.channels());
+ QVERIFY(format.frequency() == f.frequency());
+ QVERIFY(format.sampleSize() == f.sampleSize());
+ QVERIFY(format.codec() == f.codec());
+ QVERIFY(format.byteOrder() == f.byteOrder());
+ QVERIFY(format.sampleType() == f.sampleType());
}
void tst_QAudioInput::buffers()
{
- if(available) {
- // Should always have a buffer size greater than zero.
- int store = audio->bufferSize();
- audio->setBufferSize(4096);
- QVERIFY(audio->bufferSize() > 0);
- audio->setBufferSize(store);
- QVERIFY(audio->bufferSize() == store);
- }
+ if (!available)
+ QSKIP("No audio input device found, no test will be performed", SkipAll);
+
+ // Should always have a buffer size greater than zero.
+ int store = audio->bufferSize();
+ audio->setBufferSize(4096);
+ QVERIFY(audio->bufferSize() > 0);
+ audio->setBufferSize(store);
+ QVERIFY(audio->bufferSize() == store);
}
void tst_QAudioInput::notifyInterval()
{
- if(available) {
- QVERIFY(audio->notifyInterval() == 1000); // Default
+ if (!available)
+ QSKIP("No audio input device found, no test will be performed", SkipAll);
- audio->setNotifyInterval(500);
- QVERIFY(audio->notifyInterval() == 500); // Custom
+ QVERIFY(audio->notifyInterval() == 1000); // Default
- audio->setNotifyInterval(1000); // reset
- }
+ audio->setNotifyInterval(500);
+ QVERIFY(audio->notifyInterval() == 500); // Custom
+
+ audio->setNotifyInterval(1000); // reset
}
void tst_QAudioInput::pullFile()
{
- if(available) {
- QFile filename(SRCDIR"test.raw");
- filename.open( QIODevice::WriteOnly | QIODevice::Truncate );
-
- QSignalSpy readSignal(audio, SIGNAL(notify()));
- QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State)));
-
- // Always have default states, before start
- QVERIFY(audio->state() == QAudio::StoppedState);
- QVERIFY(audio->error() == QAudio::NoError);
- QVERIFY(audio->elapsedUSecs() == 0);
-
- audio->start(&filename);
- QTest::qWait(20);
- // Check state and periodSize() are valid non-zero values.
- QVERIFY(audio->state() == QAudio::ActiveState);
- QVERIFY(audio->error() == QAudio::NoError);
- QVERIFY(audio->elapsedUSecs() > 10000 && audio->elapsedUSecs() < 800000);
- QVERIFY(audio->periodSize() > 0);
- QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState
-
- // Wait until finished...
- QTest::qWait(5000);
-
- QVERIFY(readSignal.count() > 0);
- QVERIFY(audio->processedUSecs() > 0);
-
- audio->stop();
- QTest::qWait(20);
- QVERIFY(audio->state() == QAudio::StoppedState);
- QVERIFY(audio->elapsedUSecs() == 0);
- // Can only check to make sure we got at least 1 more signal, but can be more.
- QVERIFY(stateSignal.count() > 1);
-
- filename.close();
- }
+ if (!available)
+ QSKIP("No audio input device found, no test will be performed", SkipAll);
+
+ QFile filename(SRCDIR"test.raw");
+ filename.open( QIODevice::WriteOnly | QIODevice::Truncate );
+
+ QSignalSpy readSignal(audio, SIGNAL(notify()));
+ QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State)));
+
+ // Always have default states, before start
+ QVERIFY(audio->state() == QAudio::StoppedState);
+ QVERIFY(audio->error() == QAudio::NoError);
+ QVERIFY(audio->elapsedUSecs() == 0);
+
+ audio->start(&filename);
+ QTest::qWait(20);
+ // Check state and periodSize() are valid non-zero values.
+ QVERIFY(audio->state() == QAudio::ActiveState);
+ QVERIFY(audio->error() == QAudio::NoError);
+ QVERIFY(audio->elapsedUSecs() > 10000 && audio->elapsedUSecs() < 800000);
+ QVERIFY(audio->periodSize() > 0);
+ QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState
+
+ // Wait until finished...
+ QTest::qWait(5000);
+
+ QVERIFY(readSignal.count() > 0);
+ QVERIFY(audio->processedUSecs() > 0);
+
+ audio->stop();
+ QTest::qWait(20);
+ QVERIFY(audio->state() == QAudio::StoppedState);
+ QVERIFY(audio->elapsedUSecs() == 0);
+ // Can only check to make sure we got at least 1 more signal, but can be more.
+ QVERIFY(stateSignal.count() > 1);
+
+ filename.close();
}
QTEST_MAIN(tst_QAudioInput)
diff --git a/tests/auto/qdialog/tst_qdialog.cpp b/tests/auto/qdialog/tst_qdialog.cpp
index 6d9f798..86dde21 100644
--- a/tests/auto/qdialog/tst_qdialog.cpp
+++ b/tests/auto/qdialog/tst_qdialog.cpp
@@ -467,6 +467,22 @@ void tst_QDialog::throwInExec()
#if defined(Q_WS_MAC) || (defined(Q_WS_WINCE) && defined(_ARM_))
QSKIP("Throwing exceptions in exec() is not supported on this platform.", SkipAll);
#endif
+
+#if defined(Q_OS_LINUX)
+ // C++ exceptions can't be passed through glib callbacks. Skip the test if
+ // we're using the glib event loop.
+ QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className();
+ if (dispatcher.contains("Glib")) {
+ QSKIP(
+ qPrintable(QString(
+ "Throwing exceptions in exec() won't work if %1 event dispatcher is used.\n"
+ "Try running with QT_NO_GLIB=1 in environment."
+ ).arg(QString::fromLatin1(dispatcher))),
+ SkipAll
+ );
+ }
+#endif
+
int caughtExceptions = 0;
try {
ExceptionDialog dialog;
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index 08d2e88..81da8a3 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -80,7 +80,9 @@
# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
#elif defined(Q_OS_UNIX)
#ifdef QT_BUILD_INTERNAL
+QT_BEGIN_NAMESPACE
extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0);
+QT_END_NAMESPACE
#endif
#endif
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 6abbdcd..2c88561 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -1770,6 +1770,13 @@ void tst_QLineEdit::passwordEchoDelay()
QApplication::sendEvent(testWidget, &ev);
QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7'));
+ testWidget->setCursorPosition(3);
+ QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7'));
+ QTest::keyPress(testWidget, 'a');
+ QCOMPARE(testWidget->displayText(), QString(3, fillChar) + QLatin1Char('a') + QString(5, fillChar));
+ QTest::keyPress(testWidget, Qt::Key_Backspace);
+ QCOMPARE(testWidget->displayText(), QString(8, fillChar));
+
// restore clean state
testWidget->setEchoMode(QLineEdit::Normal);
}
diff --git a/tests/auto/qpushbutton/tst_qpushbutton.cpp b/tests/auto/qpushbutton/tst_qpushbutton.cpp
index 7742f6b..db4f385 100644
--- a/tests/auto/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/qpushbutton/tst_qpushbutton.cpp
@@ -91,6 +91,9 @@ private slots:
void animateClick();
void toggle();
void clicked();
+#ifdef Q_OS_MAC
+ void macClicked();
+#endif
void toggled();
void isEnabled();
void defaultAndAutoDefault();
@@ -469,6 +472,34 @@ void tst_QPushButton::clicked()
QCOMPARE( release_count, (uint)10 );
}
+#ifdef Q_OS_MAC
+// test that the corners of a mac style button are not treated as clicks.
+// but that if a style is applied, they are.
+void tst_QPushButton::macClicked()
+{
+ QPushButton *macTestWidget = new QPushButton( "Push button" );
+ macTestWidget->show();
+ connect( macTestWidget, SIGNAL(clicked()), this, SLOT(onClicked()) );
+
+ QTest::mouseClick( macTestWidget, Qt::LeftButton, 0, QPoint(1,1) );
+ QVERIFY( click_count == 0 );
+
+ QTest::mouseClick( macTestWidget, Qt::LeftButton, 0, macTestWidget->rect().center() );
+ QVERIFY( click_count == 1 );
+
+ resetCounters();
+ macTestWidget->setStyleSheet("background: white;");
+
+ QTest::mouseClick( macTestWidget, Qt::LeftButton, 0, QPoint(1,1) );
+ QVERIFY( click_count == 1 );
+
+ QTest::mouseClick( macTestWidget, Qt::LeftButton, 0, macTestWidget->rect().center() );
+ QVERIFY( click_count == 2 );
+
+ delete macTestWidget;
+}
+#endif
+
/*
void tst_QPushButton::group()
{
diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp
index 2b0ba42..cc3b1dc 100644
--- a/tests/auto/qtextcursor/tst_qtextcursor.cpp
+++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp
@@ -50,6 +50,7 @@
#include <qabstracttextdocumentlayout.h>
#include <qtextlayout.h>
#include <qtextcursor.h>
+#include <qtextobject.h>
#include <qdebug.h>
//TESTED_FILES=gui/text/qtextcursor.cpp gui/text/qtextcursor_p.h
@@ -154,6 +155,8 @@ private slots:
void cursorPositionWithBlockUndoAndRedo2();
void cursorPositionWithBlockUndoAndRedo3();
+ void joinNonEmptyRemovedBlockUserState();
+
private:
int blockCount();
@@ -1858,5 +1861,20 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo3()
QCOMPARE(cursor.position(), cursorPositionBefore);
}
+void tst_QTextCursor::joinNonEmptyRemovedBlockUserState()
+{
+ cursor.insertText("Hello");
+ cursor.insertBlock();
+ cursor.insertText("World");
+ cursor.block().setUserState(10);
+
+ cursor.movePosition(QTextCursor::EndOfBlock);
+ cursor.movePosition(QTextCursor::PreviousBlock, QTextCursor::KeepAnchor);
+ cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
+ cursor.removeSelectedText();
+
+ QCOMPARE(cursor.block().userState(), 10);
+}
+
QTEST_MAIN(tst_QTextCursor)
#include "tst_qtextcursor.moc"