diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPagePom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPagePom.cs index aecca8f7..7fa70bb9 100644 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPagePom.cs +++ b/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPagePom.cs @@ -11,9 +11,6 @@ namespace Calculator.UIAutomationLibrary.Components /// /// Physical Object Model for the app window. /// POM is the implementation model of the app. - /// See following references to POM: - /// * https://blogs.msdn.microsoft.com/wltester/2011/11/14/object-model-design/ - /// * https://blogs.msdn.microsoft.com/micahel/2005/06/03/how-do-i-invoke-thee-let-me-count-the-ways-the-physical-object-model/ /// See https://en.wikipedia.org/wiki/Model-based_testing for model-based testing. /// public class MainPagePom : UIObject diff --git a/src/CalcManager/ExpressionCommand.h b/src/CalcManager/ExpressionCommand.h index 03a2af6b..2958f4f8 100644 --- a/src/CalcManager/ExpressionCommand.h +++ b/src/CalcManager/ExpressionCommand.h @@ -10,9 +10,9 @@ class CParentheses final : public IParenthesisCommand { public: CParentheses(_In_ int command); - int GetCommand() const; - CalculationManager::CommandType GetCommandType() const; - void Accept(_In_ ISerializeCommandVisitor &commandVisitor); + int GetCommand() const override; + CalculationManager::CommandType GetCommandType() const override; + void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override; private: int m_command; @@ -23,11 +23,11 @@ class CUnaryCommand final : public IUnaryCommand public: CUnaryCommand(int command); CUnaryCommand(int command1, int command2); - const std::shared_ptr> & GetCommands() const; - CalculationManager::CommandType GetCommandType() const; - void SetCommand(int command); - void SetCommands(int command1, int command2); - void Accept(_In_ ISerializeCommandVisitor &commandVisitor); + const std::shared_ptr> & GetCommands() const override; + CalculationManager::CommandType GetCommandType() const override; + void SetCommand(int command) override; + void SetCommands(int command1, int command2) override; + void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override; private: std::shared_ptr> m_command; @@ -37,10 +37,10 @@ class CBinaryCommand final : public IBinaryCommand { public: CBinaryCommand(int command); - void SetCommand(int command); - int GetCommand() const; - CalculationManager::CommandType GetCommandType() const; - void Accept(_In_ ISerializeCommandVisitor &commandVisitor); + void SetCommand(int command) override; + int GetCommand() const override; + CalculationManager::CommandType GetCommandType() const override; + void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override; private: int m_command; @@ -56,17 +56,17 @@ public: bool fSciFmt); void Initialize(CalcEngine::Rational const& rat); - const std::shared_ptr> & GetCommands() const; - void SetCommands(std::shared_ptr> const& commands); - void AppendCommand(int command); - void ToggleSign(); - void RemoveFromEnd(); - bool IsNegative() const; - bool IsSciFmt() const; - bool IsDecimalPresent() const; - const std::wstring & GetToken(wchar_t decimalSymbol); - CalculationManager::CommandType GetCommandType() const; - void Accept(_In_ ISerializeCommandVisitor &commandVisitor); + const std::shared_ptr> & GetCommands() const override; + void SetCommands(std::shared_ptr> const& commands) override; + void AppendCommand(int command) override; + void ToggleSign() override; + void RemoveFromEnd() override; + bool IsNegative() const override; + bool IsSciFmt() const override; + bool IsDecimalPresent() const override; + const std::wstring & GetToken(wchar_t decimalSymbol) override; + CalculationManager::CommandType GetCommandType() const override; + void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override; std::wstring GetString(uint32_t radix, int32_t precision); private: diff --git a/src/CalcManager/ExpressionCommandInterface.h b/src/CalcManager/ExpressionCommandInterface.h index bf19bf2f..ce89dd81 100644 --- a/src/CalcManager/ExpressionCommandInterface.h +++ b/src/CalcManager/ExpressionCommandInterface.h @@ -30,7 +30,7 @@ public: class IBinaryCommand : public IOperatorCommand { public: - virtual void SetCommand(int command) = 0; + virtual void SetCommand(int command) override = 0; virtual int GetCommand() const = 0; }; diff --git a/src/CalcViewModel/Common/LocalizationSettings.h b/src/CalcViewModel/Common/LocalizationSettings.h index aebb1876..414af6c3 100644 --- a/src/CalcViewModel/Common/LocalizationSettings.h +++ b/src/CalcViewModel/Common/LocalizationSettings.h @@ -26,8 +26,9 @@ namespace CalculatorApp m_digitSymbols.at(i) = formatter->FormatUInt(i)->Data()[0]; } + wchar_t resolvedName[LOCALE_NAME_MAX_LENGTH]; result = ResolveLocaleName(formatter->ResolvedLanguage->Data(), - m_resolvedName, + resolvedName, LOCALE_NAME_MAX_LENGTH); if (result == 0) { @@ -35,8 +36,9 @@ namespace CalculatorApp } else { + m_resolvedName = resolvedName; wchar_t decimalString[LocaleSettingBufferSize] = L""; - result = GetLocaleInfoEx(m_resolvedName, + result = GetLocaleInfoEx(m_resolvedName.c_str(), LOCALE_SDECIMAL, decimalString, ARRAYSIZE(decimalString)); @@ -46,7 +48,7 @@ namespace CalculatorApp } wchar_t groupingSymbolString[LocaleSettingBufferSize] = L""; - result = GetLocaleInfoEx(m_resolvedName, + result = GetLocaleInfoEx(m_resolvedName.c_str(), LOCALE_STHOUSAND, groupingSymbolString, ARRAYSIZE(groupingSymbolString)); @@ -56,7 +58,7 @@ namespace CalculatorApp } wchar_t numberGroupingString[LocaleSettingBufferSize] = L""; - result = GetLocaleInfoEx(m_resolvedName, + result = GetLocaleInfoEx(m_resolvedName.c_str(), LOCALE_SGROUPING, numberGroupingString, ARRAYSIZE(numberGroupingString)); @@ -77,7 +79,7 @@ namespace CalculatorApp } int currencyTrailingDigits = 0; - result = GetLocaleInfoEx(m_resolvedName, + result = GetLocaleInfoEx(m_resolvedName.c_str(), LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER, (LPWSTR)¤cyTrailingDigits, sizeof(currencyTrailingDigits) / sizeof(WCHAR)); @@ -147,7 +149,7 @@ namespace CalculatorApp Platform::String^ GetLocaleName() const { - return ref new Platform::String(m_resolvedName); + return ref new Platform::String(m_resolvedName.c_str()); } bool IsDigitEnUsSetting() const @@ -377,7 +379,7 @@ namespace CalculatorApp Platform::String^ m_calendarIdentifier; Windows::Globalization::DayOfWeek m_firstDayOfWeek; int m_currencySymbolPrecedence; - wchar_t m_resolvedName[LOCALE_NAME_MAX_LENGTH]; + std::wstring m_resolvedName; int m_currencyTrailingDigits; static const unsigned int LocaleSettingBufferSize = 16; }; diff --git a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp index 49585320..4bb4f727 100644 --- a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp +++ b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp @@ -275,7 +275,7 @@ pair CurrencyDataLoader::GetCurrencyRatioEquality(_In_ const U { double ratio = (iter2->second).ratio; - // Round the raio to FORMATTER_DIGIT_COUNT digits using int math. + // Round the ratio to FORMATTER_DIGIT_COUNT digits using int math. // Ex: to round 1.23456 to three digits, use // ((int) 1.23456 * (10^3)) / (10^3) double scale = pow(10, FORMATTER_DIGIT_COUNT);