Merge branch 'master' into buildw4

This commit is contained in:
Brett Waldbaum 2019-03-08 14:41:13 -08:00 committed by GitHub
commit 74e819e035
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 35 deletions

View file

@ -11,9 +11,6 @@ namespace Calculator.UIAutomationLibrary.Components
/// <summary>
/// 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.
/// </summary>
public class MainPagePom : UIObject

View file

@ -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<CalculatorVector<int>> & 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<CalculatorVector<int>> & 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<CalculatorVector<int>> 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<CalculatorVector<int>> & GetCommands() const;
void SetCommands(std::shared_ptr<CalculatorVector<int>> 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<CalculatorVector<int>> & GetCommands() const override;
void SetCommands(std::shared_ptr<CalculatorVector<int>> 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:

View file

@ -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;
};

View file

@ -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)&currencyTrailingDigits,
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;
};

View file

@ -275,7 +275,7 @@ pair<wstring, wstring> 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);