tst_QInputMethod: Don't assume test is the only one calling functions

After d9bb8c0a17 we call inputDirection()
on the platform input context to initialize the direction at startup.

The test can't assume there are no other callers to the functions
in the QPlatformInputContext layer.

Change-Id: Ic1cecd608b2759e703a17838fcf24b4ff53ad07e
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-10-09 16:17:10 +02:00
parent 4bf444bef9
commit 260ac1891a

View File

@ -249,13 +249,13 @@ void tst_qinputmethod::query()
void tst_qinputmethod::inputDirection()
{
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 0);
auto originalCount = m_platformInputContext.m_inputDirectionCallCount;
qApp->inputMethod()->inputDirection();
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 1);
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, originalCount + 1);
QCOMPARE(m_platformInputContext.m_localeCallCount, 0);
originalCount = m_platformInputContext.m_localeCallCount;
qApp->inputMethod()->locale();
QCOMPARE(m_platformInputContext.m_localeCallCount, 1);
QCOMPARE(m_platformInputContext.m_localeCallCount, originalCount + 1);
}
void tst_qinputmethod::inputMethodAccepted()