From 849e46599f0751ba5994d036df140d10e76e223c Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 30 Sep 2009 14:48:48 +0300 Subject: Fixed qdoublespinbox undoRedo test case for Symbian. Symbian does not have keysequene associated to redo functionality. Changed the test so that it checks if key sequence is associated to needed functionality and if not test is skipped and warning printed. Reviewed-by: Aleksandar Sasha Babic --- tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 30 ++++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index f4ea985..3d2fa42 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -936,19 +936,29 @@ void tst_QDoubleSpinBox::undoRedo() //testing CTRL+Z (undo) int val = QKeySequence(QKeySequence::Undo)[0]; - Qt::KeyboardModifiers mods = (Qt::KeyboardModifiers)(val & Qt::KeyboardModifierMask); - QTest::keyClick(&spin, val & ~mods, mods); - QCOMPARE(spin.value(), 0.0); - QVERIFY(!spin.lineEdit()->isUndoAvailable()); - QVERIFY(spin.lineEdit()->isRedoAvailable()); + if (val != 0) { + Qt::KeyboardModifiers mods = (Qt::KeyboardModifiers)(val & Qt::KeyboardModifierMask); + QTest::keyClick(&spin, val & ~mods, mods); + QCOMPARE(spin.value(), 0.0); + QVERIFY(!spin.lineEdit()->isUndoAvailable()); + QVERIFY(spin.lineEdit()->isRedoAvailable()); + } else { + QWARN("Undo not tested because no key sequence associated to QKeySequence::Redo"); + } + //testing CTRL+Y (redo) val = QKeySequence(QKeySequence::Redo)[0]; - mods = (Qt::KeyboardModifiers)(val & Qt::KeyboardModifierMask); - QTest::keyClick(&spin, val & ~mods, mods); - QCOMPARE(spin.value(), 1.0); - QVERIFY(!spin.lineEdit()->isRedoAvailable()); - QVERIFY(spin.lineEdit()->isUndoAvailable()); + if (val != 0) { + Qt::KeyboardModifiers mods = (Qt::KeyboardModifiers)(val & Qt::KeyboardModifierMask); + QTest::keyClick(&spin, val & ~mods, mods); + QCOMPARE(spin.value(), 1.0); + QVERIFY(!spin.lineEdit()->isRedoAvailable()); + QVERIFY(spin.lineEdit()->isUndoAvailable()); + } else { + QWARN("Redo not tested because no key sequence associated to QKeySequence::Redo"); + } + spin.setValue(55.0); QVERIFY(!spin.lineEdit()->isUndoAvailable()); -- cgit v0.12