Writing factorized tests with datasets
We will now turn our attention to testing the Track
class. We will focus specifically on the different states a Track
class can have: STOPPED
, PLAYING
, and RECORDING
. For each one of these states, we want to make sure that adding SoundEvents
works only if we are in the proper state (RECORDING
).
To do so, we could write the following test functions:
testAddSoundEvent()
: This function puts theTrack
in theSTOPPED
state, callstrack.addSoundEvent(0)
, and checkstrack.soundEvents().size == 0
testAddSoundEvent()
: This function puts theTrack
in thePLAYING
state, callstrack.addSoundEvent(0),
and checkstrack.soundEvents().size == 0
testAddSoundEvent()
: This function puts theTrack
in theRECORDING
state, calls ...
Get Mastering Qt 5 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.