mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Merge branch 'master' into buildw4
This commit is contained in:
commit
74e819e035
5 changed files with 34 additions and 35 deletions
|
@ -11,9 +11,6 @@ namespace Calculator.UIAutomationLibrary.Components
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Physical Object Model for the app window.
|
/// Physical Object Model for the app window.
|
||||||
/// POM is the implementation model of the app.
|
/// 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.
|
/// See https://en.wikipedia.org/wiki/Model-based_testing for model-based testing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MainPagePom : UIObject
|
public class MainPagePom : UIObject
|
||||||
|
|
|
@ -10,9 +10,9 @@ class CParentheses final : public IParenthesisCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CParentheses(_In_ int command);
|
CParentheses(_In_ int command);
|
||||||
int GetCommand() const;
|
int GetCommand() const override;
|
||||||
CalculationManager::CommandType GetCommandType() const;
|
CalculationManager::CommandType GetCommandType() const override;
|
||||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor);
|
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_command;
|
int m_command;
|
||||||
|
@ -23,11 +23,11 @@ class CUnaryCommand final : public IUnaryCommand
|
||||||
public:
|
public:
|
||||||
CUnaryCommand(int command);
|
CUnaryCommand(int command);
|
||||||
CUnaryCommand(int command1, int command2);
|
CUnaryCommand(int command1, int command2);
|
||||||
const std::shared_ptr<CalculatorVector<int>> & GetCommands() const;
|
const std::shared_ptr<CalculatorVector<int>> & GetCommands() const override;
|
||||||
CalculationManager::CommandType GetCommandType() const;
|
CalculationManager::CommandType GetCommandType() const override;
|
||||||
void SetCommand(int command);
|
void SetCommand(int command) override;
|
||||||
void SetCommands(int command1, int command2);
|
void SetCommands(int command1, int command2) override;
|
||||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor);
|
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<CalculatorVector<int>> m_command;
|
std::shared_ptr<CalculatorVector<int>> m_command;
|
||||||
|
@ -37,10 +37,10 @@ class CBinaryCommand final : public IBinaryCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CBinaryCommand(int command);
|
CBinaryCommand(int command);
|
||||||
void SetCommand(int command);
|
void SetCommand(int command) override;
|
||||||
int GetCommand() const;
|
int GetCommand() const override;
|
||||||
CalculationManager::CommandType GetCommandType() const;
|
CalculationManager::CommandType GetCommandType() const override;
|
||||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor);
|
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_command;
|
int m_command;
|
||||||
|
@ -56,17 +56,17 @@ public:
|
||||||
bool fSciFmt);
|
bool fSciFmt);
|
||||||
void Initialize(CalcEngine::Rational const& rat);
|
void Initialize(CalcEngine::Rational const& rat);
|
||||||
|
|
||||||
const std::shared_ptr<CalculatorVector<int>> & GetCommands() const;
|
const std::shared_ptr<CalculatorVector<int>> & GetCommands() const override;
|
||||||
void SetCommands(std::shared_ptr<CalculatorVector<int>> const& commands);
|
void SetCommands(std::shared_ptr<CalculatorVector<int>> const& commands) override;
|
||||||
void AppendCommand(int command);
|
void AppendCommand(int command) override;
|
||||||
void ToggleSign();
|
void ToggleSign() override;
|
||||||
void RemoveFromEnd();
|
void RemoveFromEnd() override;
|
||||||
bool IsNegative() const;
|
bool IsNegative() const override;
|
||||||
bool IsSciFmt() const;
|
bool IsSciFmt() const override;
|
||||||
bool IsDecimalPresent() const;
|
bool IsDecimalPresent() const override;
|
||||||
const std::wstring & GetToken(wchar_t decimalSymbol);
|
const std::wstring & GetToken(wchar_t decimalSymbol) override;
|
||||||
CalculationManager::CommandType GetCommandType() const;
|
CalculationManager::CommandType GetCommandType() const override;
|
||||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor);
|
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||||
std::wstring GetString(uint32_t radix, int32_t precision);
|
std::wstring GetString(uint32_t radix, int32_t precision);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
class IBinaryCommand : public IOperatorCommand
|
class IBinaryCommand : public IOperatorCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void SetCommand(int command) = 0;
|
virtual void SetCommand(int command) override = 0;
|
||||||
virtual int GetCommand() const = 0;
|
virtual int GetCommand() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,9 @@ namespace CalculatorApp
|
||||||
m_digitSymbols.at(i) = formatter->FormatUInt(i)->Data()[0];
|
m_digitSymbols.at(i) = formatter->FormatUInt(i)->Data()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wchar_t resolvedName[LOCALE_NAME_MAX_LENGTH];
|
||||||
result = ResolveLocaleName(formatter->ResolvedLanguage->Data(),
|
result = ResolveLocaleName(formatter->ResolvedLanguage->Data(),
|
||||||
m_resolvedName,
|
resolvedName,
|
||||||
LOCALE_NAME_MAX_LENGTH);
|
LOCALE_NAME_MAX_LENGTH);
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
|
@ -35,8 +36,9 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_resolvedName = resolvedName;
|
||||||
wchar_t decimalString[LocaleSettingBufferSize] = L"";
|
wchar_t decimalString[LocaleSettingBufferSize] = L"";
|
||||||
result = GetLocaleInfoEx(m_resolvedName,
|
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||||
LOCALE_SDECIMAL,
|
LOCALE_SDECIMAL,
|
||||||
decimalString,
|
decimalString,
|
||||||
ARRAYSIZE(decimalString));
|
ARRAYSIZE(decimalString));
|
||||||
|
@ -46,7 +48,7 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t groupingSymbolString[LocaleSettingBufferSize] = L"";
|
wchar_t groupingSymbolString[LocaleSettingBufferSize] = L"";
|
||||||
result = GetLocaleInfoEx(m_resolvedName,
|
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||||
LOCALE_STHOUSAND,
|
LOCALE_STHOUSAND,
|
||||||
groupingSymbolString,
|
groupingSymbolString,
|
||||||
ARRAYSIZE(groupingSymbolString));
|
ARRAYSIZE(groupingSymbolString));
|
||||||
|
@ -56,7 +58,7 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t numberGroupingString[LocaleSettingBufferSize] = L"";
|
wchar_t numberGroupingString[LocaleSettingBufferSize] = L"";
|
||||||
result = GetLocaleInfoEx(m_resolvedName,
|
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||||
LOCALE_SGROUPING,
|
LOCALE_SGROUPING,
|
||||||
numberGroupingString,
|
numberGroupingString,
|
||||||
ARRAYSIZE(numberGroupingString));
|
ARRAYSIZE(numberGroupingString));
|
||||||
|
@ -77,7 +79,7 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
|
|
||||||
int currencyTrailingDigits = 0;
|
int currencyTrailingDigits = 0;
|
||||||
result = GetLocaleInfoEx(m_resolvedName,
|
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||||
LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER,
|
LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER,
|
||||||
(LPWSTR)¤cyTrailingDigits,
|
(LPWSTR)¤cyTrailingDigits,
|
||||||
sizeof(currencyTrailingDigits) / sizeof(WCHAR));
|
sizeof(currencyTrailingDigits) / sizeof(WCHAR));
|
||||||
|
@ -147,7 +149,7 @@ namespace CalculatorApp
|
||||||
|
|
||||||
Platform::String^ GetLocaleName() const
|
Platform::String^ GetLocaleName() const
|
||||||
{
|
{
|
||||||
return ref new Platform::String(m_resolvedName);
|
return ref new Platform::String(m_resolvedName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsDigitEnUsSetting() const
|
bool IsDigitEnUsSetting() const
|
||||||
|
@ -377,7 +379,7 @@ namespace CalculatorApp
|
||||||
Platform::String^ m_calendarIdentifier;
|
Platform::String^ m_calendarIdentifier;
|
||||||
Windows::Globalization::DayOfWeek m_firstDayOfWeek;
|
Windows::Globalization::DayOfWeek m_firstDayOfWeek;
|
||||||
int m_currencySymbolPrecedence;
|
int m_currencySymbolPrecedence;
|
||||||
wchar_t m_resolvedName[LOCALE_NAME_MAX_LENGTH];
|
std::wstring m_resolvedName;
|
||||||
int m_currencyTrailingDigits;
|
int m_currencyTrailingDigits;
|
||||||
static const unsigned int LocaleSettingBufferSize = 16;
|
static const unsigned int LocaleSettingBufferSize = 16;
|
||||||
};
|
};
|
||||||
|
|
|
@ -275,7 +275,7 @@ pair<wstring, wstring> CurrencyDataLoader::GetCurrencyRatioEquality(_In_ const U
|
||||||
{
|
{
|
||||||
double ratio = (iter2->second).ratio;
|
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
|
// Ex: to round 1.23456 to three digits, use
|
||||||
// ((int) 1.23456 * (10^3)) / (10^3)
|
// ((int) 1.23456 * (10^3)) / (10^3)
|
||||||
double scale = pow(10, FORMATTER_DIGIT_COUNT);
|
double scale = pow(10, FORMATTER_DIGIT_COUNT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue