summaryrefslogtreecommitdiffstats
path: root/tests/auto/qkeyevent/tst_qkeyevent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qkeyevent/tst_qkeyevent.cpp')
-rw-r--r--tests/auto/qkeyevent/tst_qkeyevent.cpp57
1 files changed, 46 insertions, 11 deletions
diff --git a/tests/auto/qkeyevent/tst_qkeyevent.cpp b/tests/auto/qkeyevent/tst_qkeyevent.cpp
index 27b849e..9adf97c 100644
--- a/tests/auto/qkeyevent/tst_qkeyevent.cpp
+++ b/tests/auto/qkeyevent/tst_qkeyevent.cpp
@@ -86,7 +86,7 @@ private:
KeyEventWidget::KeyEventWidget( QWidget* parent, const char* name )
- : QWidget( parent ), recievedKeyPress( FALSE ), recievedKeyRelease( FALSE ),
+ : QWidget( parent ), recievedKeyPress( false ), recievedKeyRelease( false ),
lastKeyPress( 0 ), lastKeyRelease( 0 )
{
setObjectName(name);
@@ -94,6 +94,8 @@ KeyEventWidget::KeyEventWidget( QWidget* parent, const char* name )
KeyEventWidget::~KeyEventWidget()
{
+ delete lastKeyPress;
+ delete lastKeyRelease;
}
QKeyEvent* KeyEventWidget::getLastKeyPress()
@@ -108,14 +110,18 @@ QKeyEvent* KeyEventWidget::getLastKeyRelease()
void KeyEventWidget::keyPressEvent( QKeyEvent* e )
{
- lastKeyPress = e;
- recievedKeyPress = TRUE;
+ if (lastKeyPress)
+ delete lastKeyPress;
+ lastKeyPress = new QKeyEvent(*e);
+ recievedKeyPress = true;
}
void KeyEventWidget::keyReleaseEvent( QKeyEvent* e )
{
- lastKeyRelease = e;
- recievedKeyRelease = TRUE;
+ if (lastKeyRelease)
+ delete lastKeyRelease;
+ lastKeyRelease = new QKeyEvent(*e);
+ recievedKeyRelease = true;
}
tst_QKeyEvent::tst_QKeyEvent()
@@ -151,13 +157,13 @@ void tst_QKeyEvent::sendRecieveKeyEvents_data()
continue;
}
if ( a == Qt::Key_Backtab ) // Actually SHIFT+Tab
- QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << int(Qt::Key_Tab) << FALSE << "";
+ QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << int(Qt::Key_Tab) << false << "";
else
- QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << a << FALSE << "";
+ QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << a << false << "";
}
for ( a = Qt::Key_Space; a < Qt::Key_ydiaeresis; a++ ) {
- QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << a << TRUE << QString( QChar(a) );
+ QTest::newRow( QString("key - %1").arg( a ).toLatin1() ) << a << true << QString( QChar(a) );
}
}
@@ -168,11 +174,10 @@ void tst_QKeyEvent::standardKey()
void tst_QKeyEvent::sendRecieveKeyEvents()
{
- QSKIP( "Skipped while it is being worked on", SkipAll);
QFETCH( int, key );
QFETCH( bool, textExpected );
QFETCH( QString, text );
- testWidget->recievedKeyPress = FALSE;
+ testWidget->recievedKeyPress = false;
#ifdef Q_WS_WIN
// Will be eaten by Windows system
@@ -204,6 +209,36 @@ void tst_QKeyEvent::sendRecieveKeyEvents()
return;
#endif // Q_WS_WIN
+#ifdef Q_OS_SYMBIAN
+ // Not supported on symbian
+ if ( key == Qt::Key_Print )
+ return;
+
+ // Not supported on symbian
+ if ( key == Qt::Key_SysReq )
+ return;
+
+ // Not supported on symbian
+ if ( key >= Qt::Key_F25 && key <= Qt::Key_Super_R )
+ return;
+ if ( key >= Qt::Key_Hyper_L && key <= Qt::Key_Hyper_R )
+ return;
+ if ( key == Qt::Key_Help )
+ return;
+
+ // Not sure on how to add support for these yet
+ if ( key >= Qt::Key_Direction_L && key <= Qt::Key_Direction_R )
+ return;
+
+ // Not supported on symbian
+ if ( key >= Qt::Key_Exclam && key <= Qt::Key_Slash )
+ return;
+ if ( key >= Qt::Key_Colon && key <= Qt::Key_At )
+ return;
+ if ( key >= Qt::Key_BracketRight && key <= Qt::Key_ydiaeresis )
+ return;
+#endif // Q_WS_WIN
+
if ( key == Qt::Key_F1 )
return; // Ignore for the moment
@@ -214,7 +249,7 @@ void tst_QKeyEvent::sendRecieveKeyEvents()
QCOMPARE( ke->key(), key );
if ( textExpected )
QCOMPARE( ke->text(), text );
- testWidget->recievedKeyRelease = FALSE;
+ testWidget->recievedKeyRelease = false;
QTest::keyRelease( testWidget, (Qt::Key)key );
while ( !testWidget->recievedKeyRelease )
qApp->processEvents();