summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-04-08 12:50:27 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-04-14 07:41:35 +0200
commitb5a1bc8db91414b409918bd259db89fad5025452 (patch)
treebf5d416d57249a44b4c8d6a4c06d47337b4203ab /tests/auto
parente19794b138f5c364926bb66a83c6c930f3bb85eb (diff)
Don't emit signals when attributes don't change
Leaving it to the engine implementations to ignore and return false in setters when the new value is the same as the old value is error prone and unnecessary, even if engines can sometimes chose a slightly more optimal way to compare values. Ensure that we have the right semantics in the QTextTosSpeech class directly, and add test coverage. Change-Id: Ie18b9bf4577e18f9fca9f70d1310856d1ab35f7b Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qtexttospeech/tst_qtexttospeech.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qtexttospeech/tst_qtexttospeech.cpp b/tests/auto/qtexttospeech/tst_qtexttospeech.cpp
index 885c885..3a41e64 100644
--- a/tests/auto/qtexttospeech/tst_qtexttospeech.cpp
+++ b/tests/auto/qtexttospeech/tst_qtexttospeech.cpp
@@ -140,6 +140,9 @@ void tst_QTextToSpeech::rate()
tts.setRate(0.0);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.value(0).first().toDouble(), 0.0);
+
+ tts.setRate(tts.rate());
+ QCOMPARE(spy.count(), 1);
}
void tst_QTextToSpeech::pitch()
@@ -157,6 +160,8 @@ void tst_QTextToSpeech::pitch()
QCOMPARE(tts.pitch(), i / 10.0);
#endif
QCOMPARE(spy.count(), ++signalCount);
+ tts.setPitch(tts.pitch());
+ QCOMPARE(spy.count(), signalCount);
}
}
@@ -176,6 +181,9 @@ void tst_QTextToSpeech::volume()
QVERIFY2(tts.volume() > 0.65, QByteArray::number(tts.volume()));
QVERIFY2(tts.volume() < 0.75, QByteArray::number(tts.volume()));
#endif
+
+ tts.setVolume(tts.volume());
+ QCOMPARE(spy.count(), 1);
}