-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds unit-test cases for NarratorAnnouncement after fixing issue #1386 (
#1469) * fix bug: No confirmation is announced by the narrator after activating 'Remove equation' button #1386 * Unit Test: Add NarratorAnnouncementUnitTests Co-authored-by: tain <tankle_@hotmail.com>
- Loading branch information
1 parent
565e3e2
commit 9d8e2ad
Showing
3 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 192 additions & 0 deletions
192
src/CalculatorUnitTests/NarratorAnnouncementUnitTests.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
#include "pch.h" | ||
|
||
#include <CppUnitTest.h> | ||
|
||
|
||
using namespace Windows::UI::Xaml::Automation::Peers; | ||
using namespace Microsoft::VisualStudio::CppUnitTestFramework; | ||
using namespace CalculatorApp::Common::Automation; | ||
|
||
|
||
namespace CalculatorUnitTests | ||
{ | ||
TEST_CLASS(NarratorAnnouncementUnitTests) | ||
{ | ||
public: | ||
TEST_METHOD(TestGetDisplayUpdatedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetDisplayUpdatedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"DisplayUpdated"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::Other); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetMaxDigitsReachedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetMaxDigitsReachedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"MaxDigitsReached"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::Other); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetMemoryClearedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetMemoryClearedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"MemoryCleared"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ItemRemoved); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetMemoryItemChangedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetMemoryItemChangedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"MemorySlotChanged"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::MostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetMemoryItemAddedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetMemoryItemAddedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"MemorySlotAdded"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ItemAdded); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::MostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetHistoryClearedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetHistoryClearedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"HistoryCleared"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ItemRemoved); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::MostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetHistorySlotClearedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetHistorySlotClearedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"HistorySlotCleared"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ItemRemoved); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetCategoryNameChangedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"CategoryNameChanged"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetUpdateCurrencyRatesAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetUpdateCurrencyRatesAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"UpdateCurrencyRates"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetDisplayCopiedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetDisplayCopiedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"DisplayCopied"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetOpenParenthesisCountChangedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"OpenParenthesisCountChanged"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetNoRightParenthesisAddedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetNoRightParenthesisAddedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"NoParenthesisAdded"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetGraphModeChangedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetGraphModeChangedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"GraphModeChanged"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetGraphViewChangedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetGraphViewChangedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"GraphViewChanged"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::CurrentThenMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetFunctionRemovedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetFunctionRemovedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"FunctionRemoved"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ItemRemoved); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetGraphViewBestFitChangedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetGraphViewBestFitChangedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"GraphViewBestFitChanged"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::MostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetAlwaysOnTopChangedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetAlwaysOnTopChangedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"AlwaysOnTop"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
TEST_METHOD(TestGetBitShiftRadioButtonCheckedAnnouncement) | ||
{ | ||
auto annoucement = CalculatorAnnouncement::GetBitShiftRadioButtonCheckedAnnouncement(m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->Announcement, m_testAnnouncement); | ||
VERIFY_ARE_EQUAL(annoucement->ActivityId, L"BitShiftRadioButtonContent"); | ||
VERIFY_ARE_EQUAL(annoucement->Kind, AutomationNotificationKind::ActionCompleted); | ||
VERIFY_ARE_EQUAL(annoucement->Processing, AutomationNotificationProcessing::ImportantMostRecent); | ||
} | ||
|
||
private: | ||
static const Platform::StringReference m_testAnnouncement; | ||
}; | ||
|
||
const Platform::StringReference NarratorAnnouncementUnitTests::m_testAnnouncement(L"TestAnnouncement"); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|