diff --git a/lib/core/include/av-speech-in-noise/core/IModel.hpp b/lib/core/include/av-speech-in-noise/core/IModel.hpp index 1ac6b3ba..85c24362 100644 --- a/lib/core/include/av-speech-in-noise/core/IModel.hpp +++ b/lib/core/include/av-speech-in-noise/core/IModel.hpp @@ -97,6 +97,8 @@ class RunningATestFacade { const FixedLevelTest &) = 0; virtual void initializeWithPredeterminedTargetsAndAudioRecording( const FixedLevelTest &) = 0; + virtual void initializeWithPredeterminedTargetsAndEyeTracking( + const FixedLevelTest &) = 0; virtual void playCalibration(const Calibration &) = 0; virtual void playLeftSpeakerCalibration(const Calibration &) = 0; virtual void playRightSpeakerCalibration(const Calibration &) = 0; diff --git a/lib/core/include/av-speech-in-noise/core/Model.hpp b/lib/core/include/av-speech-in-noise/core/Model.hpp index 98618fdb..a39f2000 100644 --- a/lib/core/include/av-speech-in-noise/core/Model.hpp +++ b/lib/core/include/av-speech-in-noise/core/Model.hpp @@ -35,6 +35,8 @@ class RunningATestFacadeImpl : public RunningATestFacade { const FixedLevelTest &) override; void initializeWithPredeterminedTargetsAndAudioRecording( const FixedLevelTest &) override; + void initializeWithPredeterminedTargetsAndEyeTracking( + const FixedLevelTest &) override; void initializeWithSingleSpeaker(const AdaptiveTest &) override; void initializeWithDelayedMasker(const AdaptiveTest &) override; void initializeWithTargetReplacementAndEyeTracking( diff --git a/lib/core/src/Model.cpp b/lib/core/src/Model.cpp index d936310b..98e9565b 100644 --- a/lib/core/src/Model.cpp +++ b/lib/core/src/Model.cpp @@ -121,6 +121,14 @@ void RunningATestFacadeImpl:: runningATest, fixedLevelMethod, test, &audioRecording); } +void RunningATestFacadeImpl::initializeWithPredeterminedTargetsAndEyeTracking( + const FixedLevelTest &test) { + av_speech_in_noise::initialize( + fixedLevelMethod, test, predeterminedTargets); + av_speech_in_noise::initialize( + runningATest, fixedLevelMethod, test, &eyeTracking); +} + void RunningATestFacadeImpl::initializeWithSingleSpeaker( const AdaptiveTest &test) { av_speech_in_noise::initialize( diff --git a/lib/ui/include/av-speech-in-noise/ui/TestSettingsInterpreter.hpp b/lib/ui/include/av-speech-in-noise/ui/TestSettingsInterpreter.hpp index bb56b500..24f6e6c3 100644 --- a/lib/ui/include/av-speech-in-noise/ui/TestSettingsInterpreter.hpp +++ b/lib/ui/include/av-speech-in-noise/ui/TestSettingsInterpreter.hpp @@ -22,6 +22,7 @@ enum class Method { fixedLevelFreeResponseWithAllTargetsAndEyeTracking, fixedLevelFreeResponseWithAllTargetsAndAudioRecording, fixedLevelFreeResponseWithPredeterminedTargetsAndAudioRecording, + fixedLevelFreeResponseWithPredeterminedTargetsAndEyeTracking, fixedLevelCoordinateResponseMeasureWithTargetReplacement, fixedLevelCoordinateResponseMeasureWithTargetReplacementAndEyeTracking, fixedLevelCoordinateResponseMeasureWithSilentIntervalTargets, @@ -74,6 +75,9 @@ constexpr auto name(Method c) -> const char * { fixedLevelFreeResponseWithPredeterminedTargetsAndAudioRecording: return "fixed-level free response predetermined stimuli audio " "recording"; + case Method::fixedLevelFreeResponseWithPredeterminedTargetsAndEyeTracking: + return "fixed-level free response predetermined stimuli eye " + "tracking"; case Method::fixedLevelSyllablesWithAllTargets: return "fixed-level syllables all stimuli"; case Method::unknown: diff --git a/lib/ui/src/TestSettingsInterpreter.cpp b/lib/ui/src/TestSettingsInterpreter.cpp index 138141f3..2502c4a0 100644 --- a/lib/ui/src/TestSettingsInterpreter.cpp +++ b/lib/ui/src/TestSettingsInterpreter.cpp @@ -201,6 +201,10 @@ static auto method(const std::string &contents) -> Method { fixedLevelCoordinateResponseMeasureWithSilentIntervalTargets), Method:: fixedLevelCoordinateResponseMeasureWithSilentIntervalTargets}, + {name(Method:: + fixedLevelFreeResponseWithPredeterminedTargetsAndEyeTracking), + Method:: + fixedLevelFreeResponseWithPredeterminedTargetsAndEyeTracking}, {name(Method::fixedLevelConsonants), Method::fixedLevelConsonants}, {name(Method::fixedLevelChooseKeywordsWithAllTargets), Method::fixedLevelChooseKeywordsWithAllTargets}, @@ -355,6 +359,11 @@ static void initialize(RunningATestFacade &model, Method method, startingSnr, [&](const FixedLevelTest &test) { model.initializeWithPredeterminedTargetsAndAudioRecording(test); }); + case Method::fixedLevelFreeResponseWithPredeterminedTargetsAndEyeTracking: + return av_speech_in_noise::initialize(method, contents, identity, + startingSnr, [&](const FixedLevelTest &test) { + model.initializeWithPredeterminedTargetsAndEyeTracking(test); + }); case Method:: fixedLevelCoordinateResponseMeasureWithTargetReplacementAndEyeTracking: return av_speech_in_noise::initializeFixedLevelFixedTrialsTest(method, diff --git a/macos/run.mm b/macos/run.mm index 7549ff5b..fa78e779 100644 --- a/macos/run.mm +++ b/macos/run.mm @@ -454,6 +454,9 @@ void initializeAppAndRunEventLoop(EyeTracker &eyeTracker, {Method:: fixedLevelFreeResponseWithPredeterminedTargetsAndAudioRecording, freeResponsePresenter}, + {Method:: + fixedLevelFreeResponseWithPredeterminedTargetsAndEyeTracking, + freeResponsePresenter}, {Method::fixedLevelFreeResponseWithSilentIntervalTargets, freeResponsePresenter}, {Method::fixedLevelFreeResponseWithTargetReplacement, diff --git a/test/MaskerPlayer.cpp b/test/MaskerPlayer.cpp index 6f27c2b9..d2fbd9df 100644 --- a/test/MaskerPlayer.cpp +++ b/test/MaskerPlayer.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace av_speech_in_noise { constexpr auto operator==(const PlayerTime &a, const PlayerTime &b) -> bool { diff --git a/test/Model.cpp b/test/Model.cpp index 5dba1f1c..8edb39be 100644 --- a/test/Model.cpp +++ b/test/Model.cpp @@ -772,6 +772,30 @@ class InitializingFixedLevelTestWithPredeterminedTargetsAndAudioRecording auto testMethod() -> const TestMethod * override { return method; } }; +class InitializingFixedLevelTestWithPredeterminedTargetsAndEyeTracking + : public InitializingFixedLevelTest { + FixedLevelTest test_; + FixedLevelMethodStub *method; + + public: + explicit InitializingFixedLevelTestWithPredeterminedTargetsAndEyeTracking( + FixedLevelMethodStub *method) + : method{method} {} + + void run(RunningATestFacadeImpl &model) override { + model.initializeWithPredeterminedTargetsAndEyeTracking(test_); + } + + void run( + RunningATestFacadeImpl &model, const FixedLevelTest &test) override { + model.initializeWithPredeterminedTargetsAndEyeTracking(test); + } + + auto test() -> const Test & override { return test_; } + + auto testMethod() -> const TestMethod * override { return method; } +}; + auto initializedWithEyeTracking( RecognitionTestModelStub &m, RunningATest::Observer *observer) -> bool { return m.observer == observer; @@ -881,6 +905,9 @@ class ModelTests : public ::testing::Test { InitializingFixedLevelTestWithPredeterminedTargetsAndAudioRecording initializingFixedLevelTestWithPredeterminedTargetsAndAudioRecording{ &fixedLevelMethod}; + InitializingFixedLevelTestWithPredeterminedTargetsAndEyeTracking + initializingFixedLevelTestWithPredeterminedTargetsAndEyeTracking{ + &fixedLevelMethod}; void run(InitializingTestUseCase &useCase) { useCase.run(model); } @@ -1297,6 +1324,12 @@ MODEL_TEST( initializingFixedLevelTestWithPredeterminedTargetsAndAudioRecording); } +MODEL_TEST( + initializingFixedLevelTestWithPredeterminedTargetsAndEyeTrackingInitializesFixedLevelMethod) { + assertInitializesFixedLevelMethod( + initializingFixedLevelTestWithPredeterminedTargetsAndEyeTracking); +} + MODEL_TEST( initializeFixedLevelTestWithSilentIntervalTargetsAndEyeTrackingInitializesFixedLevelMethod) { assertInitializesFixedLevelMethod( @@ -1359,6 +1392,13 @@ MODEL_TEST( predeterminedTargets); } +MODEL_TEST( + initializeFixedLevelTestWithPredeterminedTargetsAndEyeTrackingInitializesWithPredeterminedTargets) { + assertInitializesFixedLevelTestWithTargetPlaylist( + initializingFixedLevelTestWithPredeterminedTargetsAndEyeTracking, + predeterminedTargets); +} + MODEL_TEST( initializeFixedLevelTestWithEachTargetNTimesInitializesWithEachTargetNTimes) { assertInitializesFixedLevelTestWithTargetPlaylist( @@ -1519,6 +1559,13 @@ MODEL_TEST(initializeAdaptiveTestWithEyeTrackingInitializesWithEyeTracking) { initializedWithEyeTracking(internalModel, &eyeTracking)); } +MODEL_TEST( + initializeFixedLevelTestWithPredertiminedTargetsAndEyeTrackingInitializesWithEyeTracking) { + run(initializingFixedLevelTestWithPredeterminedTargetsAndEyeTracking); + AV_SPEECH_IN_NOISE_EXPECT_TRUE( + initializedWithEyeTracking(internalModel, &eyeTracking)); +} + MODEL_TEST( initializeAdaptiveTestWithCyclicTargetsAndEyeTrackingInitializesWithEyeTracking) { run(initializingAdaptiveTestWithCyclicTargetsAndEyeTracking); diff --git a/test/ModelStub.hpp b/test/ModelStub.hpp index 47940bf2..61fb5281 100644 --- a/test/ModelStub.hpp +++ b/test/ModelStub.hpp @@ -190,6 +190,11 @@ class ModelStub : public RunningATestFacade { fixedLevelTest_ = p; } + void initializeWithPredeterminedTargetsAndEyeTracking( + const FixedLevelTest &p) override { + fixedLevelTest_ = p; + } + void completeTrial() { listener_->trialComplete(); } void setAudioDevices(std::vector v) { diff --git a/test/TestSettingsInterpreter.cpp b/test/TestSettingsInterpreter.cpp index 7eb9eee1..619b95dd 100644 --- a/test/TestSettingsInterpreter.cpp +++ b/test/TestSettingsInterpreter.cpp @@ -412,6 +412,13 @@ TEST_SETTINGS_INTERPRETER_TEST( fixedLevelTestIdentity); } +TEST_SETTINGS_INTERPRETER_TEST( + fixedLevelFreeResponseWithPredeterminedTargetsAndEyeTrackingPassesMethod) { + assertPassesTestMethod(interpreter, model, sessionController, + Method::fixedLevelFreeResponseWithPredeterminedTargetsAndEyeTracking, + fixedLevelTestIdentity); +} + TEST_SETTINGS_INTERPRETER_TEST(adaptivePassFailOverridesTestIdentity) { assertOverridesTestIdentity(interpreter, model, sessionController, Method::adaptivePassFail, adaptiveTestIdentity); diff --git a/test/TestSetup.cpp b/test/TestSetup.cpp index c0128119..0a5570e2 100644 --- a/test/TestSetup.cpp +++ b/test/TestSetup.cpp @@ -380,6 +380,11 @@ class RequestFailingModel : public RunningATestFacade { throw RequestFailure{errorMessage}; } + void initializeWithPredeterminedTargetsAndEyeTracking( + const FixedLevelTest &) override { + throw RequestFailure{errorMessage}; + } + void initializeWithSingleSpeaker(const AdaptiveTest &) override { throw RequestFailure{errorMessage}; }