avs-device-sdk/MediaPlayer/GStreamerMediaPlayer/test/NormalizerTest.cpp

131 lines
3.4 KiB
C++
Raw Normal View History

Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
Version 1.5.0 alexa-client-sdk Changes in this update: **Enhancements** * Added the `ExternalMediaPlayer` Capability Agent. This allows playback from music providers that control their own playback queue. Example: Spotify. * Added support for AU and NZ to the `SampleApp`. * Firmware version can now be sent to Alexa via the `SoftwareInfo` event. The firmware version is specified in the config file under the `sampleApp` object as an integer value named [`firmwareVersion`](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L52). * The new `f` command was added to the `SampleApp` which allows the firmware version to be updated at run-time. * Optional configuration changes have been introduced. Now a [default log level](https://github.com/alexa/avs-device-sdk/blob/master/Integration/AlexaClientSDKConfig.json#L93) can be set for `ACSDK_LOG_MODULE` components, globally or individually. This value is specified under a new root level configuration object called `logger`, and the value itself is named `logLevel`. This allows you to limit the degree of logging to that default value, such as `ERROR`or `INFO`. **Bug Fixes** * Fixed bug where `AudioPlayer` progress reports were not being sent, or were being sent incorrectly. * [Issue 408](https://github.com/alexa/avs-device-sdk/issues/408) - Irrelevant code related to `UrlSource` was removed from the `GStreamer-based MediaPlayer` implementation. * The `TZ` variable no longer needs to be set to `UTC` when building the `SampleApp`. * Fixed a bug where `CurlEasyHandleWrapper` logged unwanted data on failure conditions. * Fixed a bug to improve `SIGPIPE` handling. * Fixed a bug where the filename and classname were mismatched. Changed `UrlToAttachmentConverter.h` to `UrlContentToAttachmentConverter.h`,and `UrlToAttachmentConverter.cpp` to `UrlContentToAttachmentConverter.cpp` **Known Issues** * The `ACL` may encounter issues if audio attachments are received but not consumed. * Display Cards for Kindle don't render. * If using the GStreamer-based `MediaPlayer` implementation, after muting and un-muting an audio item, the next item in the queue will begin playing rather than continuing playback of the originally muted audio item. * `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release. * Music playback doesn't immediately stop when a user barges-in on iHeartRadio.
2018-02-12 23:31:53 +00:00
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "MediaPlayer/Normalizer.h"
namespace alexaClientSDK {
namespace mediaPlayer {
namespace test {
using namespace testing;
class NormalizerTest : public ::testing::Test {};
/**
* Test normalize with a nullptr.
*/
TEST_F(NormalizerTest, test_normalizeNullResult) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
ASSERT_FALSE(Normalizer::create(0, 1, 0, 1)->normalize(1, nullptr));
}
/**
* Test create with a source min larger than source max.
*/
TEST_F(NormalizerTest, test_createSourceMinGreaterThanMax) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
ASSERT_EQ(Normalizer::create(100, 0, 0, 1), nullptr);
}
/**
* Test create with a source min equal to source max.
*/
TEST_F(NormalizerTest, test_createSourceMinEqualToMax) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
ASSERT_EQ(Normalizer::create(0, 0, 0, 1), nullptr);
}
/**
* Test create with a normalized min larger than normalized max.
*/
TEST_F(NormalizerTest, test_createNormalizeMinGreaterThanMax) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
ASSERT_EQ(Normalizer::create(0, 1, 100, 1), nullptr);
}
/**
* Test normalize with a normalized min equal to normalized max.
*/
TEST_F(NormalizerTest, test_normalizeNormalizedMinEqualToMax) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
double result;
ASSERT_TRUE(Normalizer::create(0, 10, 1, 1)->normalize(2, &result));
ASSERT_EQ(result, 1);
}
/**
* Test normalize with an input outside the source bounds.
*/
TEST_F(NormalizerTest, test_normalizeInputOutsideSourceBounds) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
double result;
ASSERT_FALSE(Normalizer::create(0, 1, 0, 1)->normalize(2, &result));
}
/**
* Test normalizing to the same range.
*/
TEST_F(NormalizerTest, test_normalizeSameScale) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
double result;
ASSERT_TRUE(Normalizer::create(0, 2, 0, 2)->normalize(1, &result));
ASSERT_EQ(result, 1);
}
/**
* Test normalizing to a smaller range.
*/
TEST_F(NormalizerTest, test_normalizeScaleDown) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
double result;
ASSERT_TRUE(Normalizer::create(0, 100, 0, 10)->normalize(50, &result));
ASSERT_EQ(result, 5);
}
/**
* Test normalizing to a larger range.
*/
TEST_F(NormalizerTest, test_normalizeScaleUp) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
double result;
ASSERT_TRUE(Normalizer::create(0, 10, 0, 100)->normalize(5, &result));
ASSERT_EQ(result, 50);
}
/**
* Test normalizing to a negative range.
*/
TEST_F(NormalizerTest, test_normalizeNegativeRange) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
double result;
ASSERT_TRUE(Normalizer::create(0, 10, -10, 0)->normalize(4, &result));
ASSERT_EQ(result, -6);
}
/**
* Test where source min != normalize min.
*/
TEST_F(NormalizerTest, test_normalizeDifferentMinimums) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
double result;
ASSERT_TRUE(Normalizer::create(1, 5, 0, 100)->normalize(2, &result));
ASSERT_EQ(result, 25);
}
/**
* Test where result is a non-integer.
*/
TEST_F(NormalizerTest, test_nonInteger) {
Version 1.2.0 alexa-client-sdk Changes in this update * **Enhancements** * Updated MediaPlayer to solve stability issues * All capability agents were refined to work with the updated MediaPlayer * Added the TemplateRuntime capability agent * Added the SpeakerManager capability agent * Added a configuration option ("sampleApp":"endpoint") that allows the endpoint that SampleApp connects to to be specified without changing code or rebuilding * Added very verbose capture of libcurl debug information * Added an observer interface to observer audio state changes from AudioPlayer * Added support for StreamMetadataExtracted Event. Stream tags found in the stream are represented in JSON and sent to AVS * Added to the SampleApp a simple GuiRenderer as an observer to the TemplateRuntime Capability Agent * Moved shared libcurl functionality to AVSCommon/Utils * Added a CMake option to exclude tests from the "make all" build. Use "cmake <absolute-path-to-source> -DACSDK_EXCLUDE_TEST_FROM_ALL=ON" to enable it. When this option is enabled "make unit" and "make integration" still could be used to build and run the tests * **Bug fixes**: * Previously scheduled alerts now play following a restart * General stability fixes * Bug fix for CertifiedSender blocking forever if the network goes down while it's trying to send a message to AVS * Fixes for known issue of Alerts integration tests fail: AlertsTest.UserLongUnrelatedBargeInOnActiveTimer and AlertsTest.handleOneTimerWithVocalStop * Attempting to end a tap-to-talk interaction with the tap-to-talk button wouldn't work * SharedDataStream could encounter a race condition due to a combination of a blocking Reader and a Writer closing before writing any data * Bug-fix for the ordering of notifications within alerts scheduling. This fixes the issue where a local-stop on an alert would also stop a subsequent alert if it were to begin without delay * **Known Issues** * Capability agent for Notifications is not included in this release * Inconsistent playback behavior when resuming content ("Alexa, pause." / "Alexa, resume."). Specifically, handling playback offsets, which causes the content to play from the start. This behavior is also occasionally seen with "Next" / "Previous". * `ACL`'s asynchronous receipt of audio attachments may manage resources poorly in scenarios where attachments are received but not consumed.
2017-10-30 22:14:38 +00:00
double result;
ASSERT_TRUE(Normalizer::create(0, 2, 0, 3)->normalize(1, &result));
ASSERT_EQ(result, 1.5);
}
} // namespace test
} // namespace mediaPlayer
} // namespace alexaClientSDK