diff options
| author | Daniel Rugerio <[email protected]> | 2019-06-28 16:08:54 -0700 |
|---|---|---|
| committer | Adonais Romero González <[email protected]> | 2019-06-28 16:08:54 -0700 |
| commit | 8ffcdad009e4d410f92fabc4e322a76a0be3a69d (patch) | |
| tree | 378b2d98a4210c61e2bc34f5b8959e87e4be5c6c /audio/tests/wavetest/WaveTestTaef.cpp | |
| parent | 75b2290f2a4ece68739d07135d352cdfec3a9e89 (diff) | |
Update audio samples (#387)
* Update SysVAD public sample.
* Add WaveTest public sample.
Diffstat (limited to 'audio/tests/wavetest/WaveTestTaef.cpp')
| -rw-r--r-- | audio/tests/wavetest/WaveTestTaef.cpp | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/audio/tests/wavetest/WaveTestTaef.cpp b/audio/tests/wavetest/WaveTestTaef.cpp new file mode 100644 index 00000000..dacf44ab --- /dev/null +++ b/audio/tests/wavetest/WaveTestTaef.cpp @@ -0,0 +1,170 @@ +// ------------------------------------------------------------------------------ +// +// Copyright (C) Microsoft. All rights reserved. +// +// File Name: +// +// WaveTestTaef.cpp +// +// Abstract: +// +// Implementation file for WaveTestTaef +// +// ------------------------------------------------------------------------------- +#include "PreComp.h" +#include "WaveTestTaef.h" +#include "tests.h" + +using namespace WEX::Common; +using namespace WEX::Logging; +using namespace WEX::TestExecution; + +#define RUN_TEST_CASE(testfn) \ +{ \ + SetVerifyOutput verifySettings(VerifyOutputSettings::LogOnlyFailures); \ + testfn(); \ +} + +IBasicLog * g_pBasicLog = NULL; +WDMAudio::WaveTest * g_pWaveTest = NULL; + +// ------------------------------------------------------------------------------- +namespace WDMAudio +{ + BEGIN_MODULE() + MODULE_PROPERTY(L"Feature", L"PortCls HCK Tests") + MODULE_PROPERTY(L"TestResourceDependent", L"true") + END_MODULE() + + // Create WEXBasicLog, Coinitialize Etc + MODULE_SETUP(WDMAudioSetup) + + // Release stuff acquired in WDMAudioSetup + MODULE_CLEANUP(WDMAudioCleanup) +}; + +bool WDMAudio::WDMAudioSetup() +{ + if (NULL == g_pBasicLog) + { + if (!(VERIFY_SUCCEEDED(CreateWexBasicLog(&g_pBasicLog)))) + { + return false; + } + } + + return true; +} + +bool WDMAudio::WDMAudioCleanup() +{ + if (g_pBasicLog) + { + g_pBasicLog->Release(); + } + + return true; +} + +// ------------------------------------------------------------------------------- +bool WDMAudio::WaveTest::WaveTestSetup() +{ + g_pWaveTest = this; + + return true; +} + +bool WDMAudio::WaveTest::WaveTestCleanUp() +{ + g_pWaveTest = NULL; + + return true; +} + +// ------------------------------------------------------------------------------- +bool WDMAudio::WaveTest::TestCaseSetup() +{ + CComPtr<ITestResource> spResource; + CComQIPtr<IHalfAppContainer> spHalfContainer; + + SetVerifyOutput verifySettings(VerifyOutputSettings::LogOnlyFailures); + + Log::Comment(L""); + Log::Comment(L"------------------------------------------------------"); + Log::Comment(L"Running test case setup"); + + size_t count = Resources::Count(); + if (!VERIFY_ARE_EQUAL(count, (size_t)1)) { return false; } + if (!VERIFY_SUCCEEDED(Resources::Item(0, &spResource))) { return false; } + + // 1. Assign m_pHalf + spHalfContainer = spResource; + if (!VERIFY_IS_NOT_NULL(spHalfContainer)) { return false; } + if (!VERIFY_SUCCEEDED(spHalfContainer->GetHalfApp(&m_pHalf))) { return false; } + + return true; +} + +bool WDMAudio::WaveTest::TestCaseCleanUp() +{ + if (!CompareWaveFormat(m_pHalf->m_pCurrentFormat.get(), m_pHalf->m_pPreferredFormat.get())) { + CloneWaveFormat(m_pHalf->m_pPreferredFormat.get(), wil::out_param(m_pHalf->m_pCurrentFormat)); + m_pHalf->m_u32CurrentDefaultPeriodicityInFrames = m_pHalf->m_u32DefaultPeriodicityInFrames; + m_pHalf->m_u32CurrentFundamentalPeriodicityInFrames = m_pHalf->m_u32FundamentalPeriodicityInFrames; + m_pHalf->m_u32CurrentMinPeriodicityInFrames = m_pHalf->m_u32MinPeriodicityInFrames; + m_pHalf->m_u32CurrentMaxPeriodicityInFrames = m_pHalf->m_u32MaxPeriodicityInFrames; + } + + if (m_pHalf != NULL) { + if (!VERIFY_SUCCEEDED(m_pHalf->CleanupStream())) { return false; } + if (!VERIFY_SUCCEEDED(m_pHalf->ReleaseEndpoint())) { return false; } + if (!VERIFY_SUCCEEDED(m_pHalf->ReleaseSineToneDataBuffer())) { return false; } + + m_pHalf = NULL; + } + + return true; +} + +// ------------------------------------------------------------------------------- +void WDMAudio::WaveTest::TAEF_StreamStateControl() +{ + RUN_TEST_CASE(Test_StreamStateControl) +} + +void WDMAudio::WaveTest::TAEF_LoopbackStreamStateControl() +{ + RUN_TEST_CASE(Test_LoopbackStreamStateControl) +} + +void WDMAudio::WaveTest::TAEF_StreamMinBufferSize() +{ + RUN_TEST_CASE(Test_StreamMinBufferSize) +} + +void WDMAudio::WaveTest::TAEF_StreamMaxBufferSize() +{ + RUN_TEST_CASE(Test_StreamMaxBufferSize) +} + +void WDMAudio::WaveTest::TAEF_StreamDifferentFormat() +{ + RUN_TEST_CASE(Test_StreamDifferentFormat) + +} + +void WDMAudio::WaveTest::TAEF_LoopbackStreamDifferentFormat() +{ + RUN_TEST_CASE(Test_LoopbackStreamDifferentFormat) + +} + +void WDMAudio::WaveTest::TAEF_StreamMultipleModes() +{ + RUN_TEST_CASE(Test_StreamMultipleModes) +} + +void WDMAudio::WaveTest::TAEF_VerifyPinSupportsPullMode() +{ + RUN_TEST_CASE(Test_VerifyPinSupportsPullMode) +}
\ No newline at end of file |
