diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-28 10:26:38 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-28 13:18:13 +0000 |
commit | 3b04cc6a4a476cb6f7a0a3f3458b7d3be1d6d84a (patch) | |
tree | f5944dc84baa72936d7066a033d844975fb00004 /tests | |
parent | faa3e095b71ea750bbde5a3a81eb7af5f7574fb8 (diff) |
tst_qmenubar: Cast char-type array subscripts to int.
Fix CLANG warnings:
tst_qmenubar.cpp:719:35: warning: array subscript is of type 'char' [-Wchar-subscripts]
QCOMPARE(m_complexTriggerCount['c'], 1);
(repeated)
Change-Id: I3628ccdd91af4d31863b3514163bb78c862b78f1
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index f7cc69f83d..9e24f373eb 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -146,7 +146,7 @@ private: QAction* m_lastSimpleAcceleratorId; int m_simpleActivatedCount; - int m_complexTriggerCount['k']; + int m_complexTriggerCount[int('k')]; }; // Testing get/set functions @@ -534,60 +534,60 @@ void tst_QMenuBar::check_accelKeys() QCOMPARE(m_complexTriggerCount[2], 0); QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 0); - QCOMPARE(m_complexTriggerCount['b'], 0); - QCOMPARE(m_complexTriggerCount['c'], 0); - QCOMPARE(m_complexTriggerCount['d'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 0); + QCOMPARE(m_complexTriggerCount[int('b')], 0); + QCOMPARE(m_complexTriggerCount[int('c')], 0); + QCOMPARE(m_complexTriggerCount[int('d')], 0); QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_A, Qt::ControlModifier); QCOMPARE(m_complexTriggerCount[1], 0); QCOMPARE(m_complexTriggerCount[2], 0); QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 1); - QCOMPARE(m_complexTriggerCount['b'], 0); - QCOMPARE(m_complexTriggerCount['c'], 0); - QCOMPARE(m_complexTriggerCount['d'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 1); + QCOMPARE(m_complexTriggerCount[int('b')], 0); + QCOMPARE(m_complexTriggerCount[int('c')], 0); + QCOMPARE(m_complexTriggerCount[int('d')], 0); QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_C, Qt::ControlModifier); QCOMPARE(m_complexTriggerCount[1], 0); QCOMPARE(m_complexTriggerCount[2], 0); QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 1); - QCOMPARE(m_complexTriggerCount['b'], 0); - QCOMPARE(m_complexTriggerCount['c'], 1); - QCOMPARE(m_complexTriggerCount['d'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 1); + QCOMPARE(m_complexTriggerCount[int('b')], 0); + QCOMPARE(m_complexTriggerCount[int('c')], 1); + QCOMPARE(m_complexTriggerCount[int('d')], 0); QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_B, Qt::ControlModifier); QCOMPARE(m_complexTriggerCount[1], 0); QCOMPARE(m_complexTriggerCount[2], 0); QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 1); - QCOMPARE(m_complexTriggerCount['b'], 1); - QCOMPARE(m_complexTriggerCount['c'], 1); - QCOMPARE(m_complexTriggerCount['d'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 1); + QCOMPARE(m_complexTriggerCount[int('b')], 1); + QCOMPARE(m_complexTriggerCount[int('c')], 1); + QCOMPARE(m_complexTriggerCount[int('d')], 0); QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_D, Qt::ControlModifier); QCOMPARE(m_complexTriggerCount[1], 0); QCOMPARE(m_complexTriggerCount[2], 0); QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 1); - QCOMPARE(m_complexTriggerCount['b'], 1); - QCOMPARE(m_complexTriggerCount['c'], 1); - QCOMPARE(m_complexTriggerCount['d'], 1); + QCOMPARE(m_complexTriggerCount[int('a')], 1); + QCOMPARE(m_complexTriggerCount[int('b')], 1); + QCOMPARE(m_complexTriggerCount[int('c')], 1); + QCOMPARE(m_complexTriggerCount[int('d')], 1); QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_J, Qt::AltModifier); QCOMPARE(m_complexTriggerCount[1], 0); QCOMPARE(m_complexTriggerCount[2], 0); QCOMPARE(m_complexTriggerCount[3], 1); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 1); - QCOMPARE(m_complexTriggerCount['b'], 1); - QCOMPARE(m_complexTriggerCount['c'], 1); - QCOMPARE(m_complexTriggerCount['d'], 1); + QCOMPARE(m_complexTriggerCount[int('a')], 1); + QCOMPARE(m_complexTriggerCount[int('b')], 1); + QCOMPARE(m_complexTriggerCount[int('c')], 1); + QCOMPARE(m_complexTriggerCount[int('d')], 1); } #endif @@ -606,10 +606,10 @@ void tst_QMenuBar::check_cursorKeys1() // the Popupmenu should be visible now QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 0); - QCOMPARE(m_complexTriggerCount['b'], 0); - QCOMPARE(m_complexTriggerCount['c'], 0); - QCOMPARE(m_complexTriggerCount['d'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 0); + QCOMPARE(m_complexTriggerCount[int('b')], 0); + QCOMPARE(m_complexTriggerCount[int('c')], 0); + QCOMPARE(m_complexTriggerCount[int('d')], 0); // Simulate a cursor key down click QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_Down ); @@ -618,10 +618,10 @@ void tst_QMenuBar::check_cursorKeys1() // Let's see if the correct slot is called... QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 0); // this shouldn't have been called - QCOMPARE(m_complexTriggerCount['b'], 1); // and this should have been called by a signal now - QCOMPARE(m_complexTriggerCount['c'], 0); - QCOMPARE(m_complexTriggerCount['d'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 0); // this shouldn't have been called + QCOMPARE(m_complexTriggerCount[int('b')], 1); // and this should have been called by a signal now + QCOMPARE(m_complexTriggerCount[int('c')], 0); + QCOMPARE(m_complexTriggerCount[int('d')], 0); } #endif @@ -648,10 +648,10 @@ void tst_QMenuBar::check_cursorKeys2() // Let's see if the correct slot is called... QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 0); // this shouldn't have been caled - QCOMPARE(m_complexTriggerCount['b'], 0); // and this should have been called by a signal ow - QCOMPARE(m_complexTriggerCount['c'], 0); - QCOMPARE(m_complexTriggerCount['d'], 1); + QCOMPARE(m_complexTriggerCount[int('a')], 0); // this shouldn't have been caled + QCOMPARE(m_complexTriggerCount[int('b')], 0); // and this should have been called by a signal ow + QCOMPARE(m_complexTriggerCount[int('c')], 0); + QCOMPARE(m_complexTriggerCount[int('d')], 1); } #endif @@ -679,10 +679,10 @@ void tst_QMenuBar::check_cursorKeys3() // Let's see if the correct slot is called... QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 0); // this shouldn't have been called - QCOMPARE(m_complexTriggerCount['b'], 1); // and this should have been called by a signal now - QCOMPARE(m_complexTriggerCount['c'], 0); - QCOMPARE(m_complexTriggerCount['d'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 0); // this shouldn't have been called + QCOMPARE(m_complexTriggerCount[int('b')], 1); // and this should have been called by a signal now + QCOMPARE(m_complexTriggerCount[int('c')], 0); + QCOMPARE(m_complexTriggerCount[int('d')], 0); } #endif @@ -715,17 +715,17 @@ void tst_QMenuBar::check_homeKey() // and press ENTER QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_Enter ); // Let's see if the correct slot is called... -// QVERIFY2( m_complexActionTriggerCount['c'] == 1, "Popupmenu should respond to a Home key" ); - QCOMPARE(m_complexTriggerCount['c'], 1); +// QVERIFY2( m_complexActionTriggerCount[int('c')] == 1, "Popupmenu should respond to a Home key" ); + QCOMPARE(m_complexTriggerCount[int('c')], 1); QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 0); - QCOMPARE(m_complexTriggerCount['b'], 0); - QCOMPARE(m_complexTriggerCount['d'], 0); - QCOMPARE(m_complexTriggerCount['e'], 0); - QCOMPARE(m_complexTriggerCount['f'], 0); - QCOMPARE(m_complexTriggerCount['g'], 0); - QCOMPARE(m_complexTriggerCount['h'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 0); + QCOMPARE(m_complexTriggerCount[int('b')], 0); + QCOMPARE(m_complexTriggerCount[int('d')], 0); + QCOMPARE(m_complexTriggerCount[int('e')], 0); + QCOMPARE(m_complexTriggerCount[int('f')], 0); + QCOMPARE(m_complexTriggerCount[int('g')], 0); + QCOMPARE(m_complexTriggerCount[int('h')], 0); } /*! @@ -754,17 +754,17 @@ void tst_QMenuBar::check_endKey() // and press ENTER QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_Enter ); // Let's see if the correct slot is called... -// QVERIFY2( m_complexActionTriggerCount['h'] == 1, "Popupmenu should respond to an End key" ); - QCOMPARE(m_complexTriggerCount['h'], 1);//, "Popupmenu should respond to an End key"); +// QVERIFY2( m_complexActionTriggerCount[int('h')] == 1, "Popupmenu should respond to an End key" ); + QCOMPARE(m_complexTriggerCount[int('h')], 1);//, "Popupmenu should respond to an End key"); QCOMPARE(m_complexTriggerCount[3], 0); QCOMPARE(m_complexTriggerCount[4], 0); - QCOMPARE(m_complexTriggerCount['a'], 0); - QCOMPARE(m_complexTriggerCount['b'], 0); - QCOMPARE(m_complexTriggerCount['c'], 0); - QCOMPARE(m_complexTriggerCount['d'], 0); - QCOMPARE(m_complexTriggerCount['e'], 0); - QCOMPARE(m_complexTriggerCount['f'], 0); - QCOMPARE(m_complexTriggerCount['g'], 0); + QCOMPARE(m_complexTriggerCount[int('a')], 0); + QCOMPARE(m_complexTriggerCount[int('b')], 0); + QCOMPARE(m_complexTriggerCount[int('c')], 0); + QCOMPARE(m_complexTriggerCount[int('d')], 0); + QCOMPARE(m_complexTriggerCount[int('e')], 0); + QCOMPARE(m_complexTriggerCount[int('f')], 0); + QCOMPARE(m_complexTriggerCount[int('g')], 0); } /*! @@ -808,7 +808,7 @@ void tst_QMenuBar::check_escKey() // and press ENTER QTest::keyClick( menu.menus.at(1), Qt::Key_Enter ); // Let's see if the correct slot is called... - QVERIFY2( m_complexTriggerCount['c'] == 1, "Expected item 2C to be selected" ); + QVERIFY2(m_complexTriggerCount[int('c')] == 1, "Expected item 2C to be selected"); } #endif |