# HG changeset patch # User Chris Cannam # Date 1434113204 -3600 # Node ID 655cd4e68e9a13a205dae7dfcefe1a5e49cae34b # Parent 5fab8e4f5f19515cd3b9c6b4650df0e5f8d2fabb More tests diff -r 5fab8e4f5f19 -r 655cd4e68e9a base/PlayParameterRepository.cpp --- a/base/PlayParameterRepository.cpp Fri Jun 12 12:41:19 2015 +0100 +++ b/base/PlayParameterRepository.cpp Fri Jun 12 13:46:44 2015 +0100 @@ -35,14 +35,14 @@ void PlayParameterRepository::addPlayable(const Playable *playable) { - cerr << "PlayParameterRepository:addPlayable playable = " << playable << endl; +// cerr << "PlayParameterRepository:addPlayable playable = " << playable << endl; if (!getPlayParameters(playable)) { // Give all playables the same type of play parameters for the // moment - cerr << "PlayParameterRepository:addPlayable: Adding play parameters for " << playable << endl; +// cerr << "PlayParameterRepository:addPlayable: Adding play parameters for " << playable << endl; PlayParameters *params = new PlayParameters; m_playParameters[playable] = params; @@ -59,8 +59,8 @@ connect(params, SIGNAL(playClipIdChanged(QString)), this, SLOT(playClipIdChanged(QString))); - cerr << "Connected play parameters " << params << " for playable " - << playable << " to this " << this << endl; +// cerr << "Connected play parameters " << params << " for playable " +// << playable << " to this " << this << endl; } } diff -r 5fab8e4f5f19 -r 655cd4e68e9a data/model/test/TestFFTModel.h --- a/data/model/test/TestFFTModel.h Fri Jun 12 12:41:19 2015 +0100 +++ b/data/model/test/TestFFTModel.h Fri Jun 12 13:46:44 2015 +0100 @@ -76,7 +76,7 @@ } } } - + private slots: // NB. FFTModel columns are centred on the sample frame, and in @@ -88,7 +88,7 @@ // (rather than something with a step in it that is harder to // reason about the FFT of) and the results for subsequent columns // are those of our expected signal. - + void dc_simple_rect() { MockWaveModel mwm({ DC }, 16, 4); test(&mwm, RectangularWindow, 8, 8, 8, 0, @@ -98,7 +98,7 @@ test(&mwm, RectangularWindow, 8, 8, 8, 2, { { { 4.f, 0.f }, {}, {}, {}, {} } }, 4); test(&mwm, RectangularWindow, 8, 8, 8, 3, - { { { }, {}, {}, {}, {} } }, 4); + { { {}, {}, {}, {}, {} } }, 4); } void dc_simple_hann() { @@ -112,9 +112,57 @@ test(&mwm, HanningWindow, 8, 8, 8, 2, { { { 4.f, 0.f }, { 2.f, 0.f }, {}, {}, {} } }, 4); test(&mwm, HanningWindow, 8, 8, 8, 3, - { { { }, {}, {}, {}, {} } }, 4); + { { {}, {}, {}, {}, {} } }, 4); } + void sine_simple_rect() { + MockWaveModel mwm({ Sine }, 16, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 0, + { { {}, {}, {}, {}, {} } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 1, + { { {}, { 0.f, 2.f }, {}, {}, {} } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 2, + { { {}, { 0.f, 2.f }, {}, {}, {} } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 3, + { { {}, {}, {}, {}, {} } }, 4); + } + + void cosine_simple_rect() { + MockWaveModel mwm({ Cosine }, 16, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 0, + { { {}, {}, {}, {}, {} } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 1, + { { {}, { 2.f, 0.f }, {}, {}, {} } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 2, + { { {}, { 2.f, 0.f }, {}, {}, {} } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 3, + { { {}, {}, {}, {}, {} } }, 4); + } + + void nyquist_simple_rect() { + MockWaveModel mwm({ Nyquist }, 16, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 0, + { { {}, {}, {}, {}, {} } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 1, + { { {}, {}, {}, {}, { 2.f, 0.f } } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 2, + { { {}, {}, {}, {}, { 2.f, 0.f } } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 3, + { { {}, {}, {}, {}, {} } }, 4); + } + + void dirac_simple_rect() { + MockWaveModel mwm({ Dirac }, 16, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 0, + { { {}, {}, {}, {}, {} } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 1, + { { { 1.f, 0.f }, { 1.f, 0.f }, { 1.f, 0.f }, { 1.f, 0.f }, { 1.f, 0.f } } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 2, + { { { 1.f, 0.f }, { 1.f, 0.f }, { 1.f, 0.f }, { 1.f, 0.f }, { 1.f, 0.f } } }, 4); + test(&mwm, RectangularWindow, 8, 8, 8, 3, + { { {}, {}, {}, {}, {} } }, 4); + } + }; #endif