mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
fix some spacing issues after merge
This commit is contained in:
parent
677211e390
commit
c64c5340a4
4 changed files with 70 additions and 75 deletions
|
@ -345,7 +345,7 @@ void LocalizationService::UpdateFontFamilyAndSize(DependencyObject ^ target)
|
||||||
|
|
||||||
// If successful, returns a formatter that respects the user's regional format settings,
|
// If successful, returns a formatter that respects the user's regional format settings,
|
||||||
// as configured by running intl.cpl.
|
// as configured by running intl.cpl.
|
||||||
DecimalFormatter^ LocalizationService::GetRegionalSettingsAwareDecimalFormatter() const
|
DecimalFormatter ^ LocalizationService::GetRegionalSettingsAwareDecimalFormatter() const
|
||||||
{
|
{
|
||||||
IIterable<String ^> ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers();
|
IIterable<String ^> ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers();
|
||||||
if (languageIdentifiers != nullptr)
|
if (languageIdentifiers != nullptr)
|
||||||
|
@ -360,7 +360,7 @@ DecimalFormatter^ LocalizationService::GetRegionalSettingsAwareDecimalFormatter(
|
||||||
// as configured by running intl.cpl.
|
// as configured by running intl.cpl.
|
||||||
//
|
//
|
||||||
// This helper function creates a DateTimeFormatter with a TwentyFour hour clock
|
// This helper function creates a DateTimeFormatter with a TwentyFour hour clock
|
||||||
DateTimeFormatter^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(_In_ String^ format) const
|
DateTimeFormatter ^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(_In_ String^ format) const
|
||||||
{
|
{
|
||||||
IIterable<String ^> ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers();
|
IIterable<String ^> ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers();
|
||||||
if (languageIdentifiers == nullptr)
|
if (languageIdentifiers == nullptr)
|
||||||
|
@ -373,8 +373,7 @@ DateTimeFormatter^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatte
|
||||||
|
|
||||||
// If successful, returns a formatter that respects the user's regional format settings,
|
// If successful, returns a formatter that respects the user's regional format settings,
|
||||||
// as configured by running intl.cpl.
|
// as configured by running intl.cpl.
|
||||||
DateTimeFormatter
|
DateTimeFormatter^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(_In_ String ^ format, _In_ String ^ calendarIdentifier, _In_ String ^ clockIdentifier) const
|
||||||
^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(_In_ String ^ format, _In_ String ^ calendarIdentifier, _In_ String ^ clockIdentifier) const
|
|
||||||
{
|
{
|
||||||
IIterable<String ^> ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers();
|
IIterable<String ^> ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers();
|
||||||
if (languageIdentifiers == nullptr)
|
if (languageIdentifiers == nullptr)
|
||||||
|
@ -385,12 +384,12 @@ DateTimeFormatter
|
||||||
return ref new DateTimeFormatter(format, languageIdentifiers, GlobalizationPreferences::HomeGeographicRegion, calendarIdentifier, clockIdentifier);
|
return ref new DateTimeFormatter(format, languageIdentifiers, GlobalizationPreferences::HomeGeographicRegion, calendarIdentifier, clockIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrencyFormatter^ LocalizationService::GetRegionalSettingsAwareCurrencyFormatter() const
|
CurrencyFormatter ^ LocalizationService::GetRegionalSettingsAwareCurrencyFormatter() const
|
||||||
{
|
{
|
||||||
String ^ userCurrency =
|
String ^ userCurrency =
|
||||||
(GlobalizationPreferences::Currencies->Size > 0) ? GlobalizationPreferences::Currencies->GetAt(0) : StringReference(DefaultCurrencyCode.data());
|
(GlobalizationPreferences::Currencies->Size > 0) ? GlobalizationPreferences::Currencies->GetAt(0) : StringReference(DefaultCurrencyCode.data());
|
||||||
|
|
||||||
IIterable<String^>^ languageIdentifiers = GetLanguageIdentifiers();
|
IIterable<String ^> ^ languageIdentifiers = GetLanguageIdentifiers();
|
||||||
if (languageIdentifiers == nullptr)
|
if (languageIdentifiers == nullptr)
|
||||||
{
|
{
|
||||||
languageIdentifiers = ApplicationLanguages::Languages;
|
languageIdentifiers = ApplicationLanguages::Languages;
|
||||||
|
@ -406,7 +405,6 @@ CurrencyFormatter^ LocalizationService::GetRegionalSettingsAwareCurrencyFormatte
|
||||||
|
|
||||||
IIterable<String ^> ^ LocalizationService::GetLanguageIdentifiers() const
|
IIterable<String ^> ^ LocalizationService::GetLanguageIdentifiers() const
|
||||||
{
|
{
|
||||||
|
|
||||||
WCHAR currentLocale[LOCALE_NAME_MAX_LENGTH] = {};
|
WCHAR currentLocale[LOCALE_NAME_MAX_LENGTH] = {};
|
||||||
int result = GetUserDefaultLocaleName(currentLocale, LOCALE_NAME_MAX_LENGTH);
|
int result = GetUserDefaultLocaleName(currentLocale, LOCALE_NAME_MAX_LENGTH);
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,14 @@ namespace CalculatorApp
|
||||||
Windows::UI::Text::FontWeight GetFontWeightOverride();
|
Windows::UI::Text::FontWeight GetFontWeightOverride();
|
||||||
double GetFontScaleFactorOverride(LanguageFontType fontType);
|
double GetFontScaleFactorOverride(LanguageFontType fontType);
|
||||||
|
|
||||||
Windows::Globalization::NumberFormatting::DecimalFormatter^ GetRegionalSettingsAwareDecimalFormatter() const;
|
Windows::Globalization::NumberFormatting::DecimalFormatter ^ GetRegionalSettingsAwareDecimalFormatter() const;
|
||||||
Windows::Globalization::DateTimeFormatting::DateTimeFormatter^ GetRegionalSettingsAwareDateTimeFormatter(_In_ Platform::String^ format) const;
|
Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ GetRegionalSettingsAwareDateTimeFormatter(_In_ Platform::String ^ format) const;
|
||||||
Windows::Globalization::DateTimeFormatting::DateTimeFormatter^ GetRegionalSettingsAwareDateTimeFormatter(
|
Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ GetRegionalSettingsAwareDateTimeFormatter(
|
||||||
_In_ Platform::String^ format,
|
_In_ Platform::String ^ format,
|
||||||
_In_ Platform::String^ calendarIdentifier,
|
_In_ Platform::String ^ calendarIdentifier,
|
||||||
_In_ Platform::String^ clockIdentifier) const;
|
_In_ Platform::String ^ clockIdentifier) const;
|
||||||
|
|
||||||
Windows::Globalization::NumberFormatting::CurrencyFormatter^ GetRegionalSettingsAwareCurrencyFormatter() const;
|
Windows::Globalization::NumberFormatting::CurrencyFormatter ^ GetRegionalSettingsAwareCurrencyFormatter() const;
|
||||||
|
|
||||||
static Platform::String ^ GetNarratorReadableToken(Platform::String ^ rawToken);
|
static Platform::String ^ GetNarratorReadableToken(Platform::String ^ rawToken);
|
||||||
static Platform::String ^ GetNarratorReadableString(Platform::String ^ rawString);
|
static Platform::String ^ GetNarratorReadableString(Platform::String ^ rawString);
|
||||||
|
@ -59,7 +59,7 @@ namespace CalculatorApp
|
||||||
Windows::Globalization::Fonts::LanguageFont ^ GetLanguageFont(LanguageFontType fontType);
|
Windows::Globalization::Fonts::LanguageFont ^ GetLanguageFont(LanguageFontType fontType);
|
||||||
Windows::UI::Text::FontWeight ParseFontWeight(Platform::String ^ fontWeight);
|
Windows::UI::Text::FontWeight ParseFontWeight(Platform::String ^ fontWeight);
|
||||||
|
|
||||||
Windows::Foundation::Collections::IIterable<Platform::String^>^ GetLanguageIdentifiers() const;
|
Windows::Foundation::Collections::IIterable<Platform::String ^> ^ GetLanguageIdentifiers() const;
|
||||||
|
|
||||||
// Attached property callbacks
|
// Attached property callbacks
|
||||||
static void OnFontTypePropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, LanguageFontType oldValue, LanguageFontType newValue);
|
static void OnFontTypePropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, LanguageFontType oldValue, LanguageFontType newValue);
|
||||||
|
@ -78,11 +78,11 @@ namespace CalculatorApp
|
||||||
|
|
||||||
static LocalizationService ^ s_singletonInstance;
|
static LocalizationService ^ s_singletonInstance;
|
||||||
|
|
||||||
Windows::Globalization::Fonts::LanguageFontGroup^ m_fontGroup;
|
Windows::Globalization::Fonts::LanguageFontGroup ^ m_fontGroup;
|
||||||
Platform::String^ m_language;
|
Platform::String ^ m_language;
|
||||||
Windows::UI::Xaml::FlowDirection m_flowDirection;
|
Windows::UI::Xaml::FlowDirection m_flowDirection;
|
||||||
bool m_overrideFontApiValues;
|
bool m_overrideFontApiValues;
|
||||||
Platform::String^ m_fontFamilyOverride;
|
Platform::String ^ m_fontFamilyOverride;
|
||||||
bool m_isLanguageOverrided;
|
bool m_isLanguageOverrided;
|
||||||
Windows::UI::Text::FontWeight m_fontWeightOverride;
|
Windows::UI::Text::FontWeight m_fontWeightOverride;
|
||||||
double m_uiTextFontScaleFactorOverride;
|
double m_uiTextFontScaleFactorOverride;
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace CalculatorApp
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
// Use DecimalFormatter as it respects the locale and the user setting
|
// Use DecimalFormatter as it respects the locale and the user setting
|
||||||
Windows::Globalization::NumberFormatting::DecimalFormatter^ formatter;
|
Windows::Globalization::NumberFormatting::DecimalFormatter ^ formatter;
|
||||||
formatter = LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter();
|
formatter = LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter();
|
||||||
formatter->FractionDigits = 0;
|
formatter->FractionDigits = 0;
|
||||||
formatter->IsDecimalPointAlwaysDisplayed = false;
|
formatter->IsDecimalPointAlwaysDisplayed = false;
|
||||||
|
|
|
@ -205,7 +205,6 @@ namespace CalculatorUnitTests
|
||||||
TEST_METHOD(LoadFromCache_Fail_NoCacheKey)
|
TEST_METHOD(LoadFromCache_Fail_NoCacheKey)
|
||||||
{
|
{
|
||||||
RemoveFromLocalSettings(CurrencyDataLoaderConstants::CacheTimestampKey);
|
RemoveFromLocalSettings(CurrencyDataLoaderConstants::CacheTimestampKey);
|
||||||
|
|
||||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||||
|
|
||||||
bool didLoad = loader.TryLoadDataFromCacheAsync().get();
|
bool didLoad = loader.TryLoadDataFromCacheAsync().get();
|
||||||
|
@ -304,8 +303,8 @@ TEST_METHOD(LoadFromCache_Success)
|
||||||
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
VERIFY_IS_TRUE(loader.LoadedFromCache());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(LoadFromWeb_Fail_ClientIsNullptr)
|
TEST_METHOD(LoadFromWeb_Fail_ClientIsNullptr)
|
||||||
{
|
{
|
||||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||||
|
|
||||||
bool didLoad = loader.TryLoadDataFromWebAsync().get();
|
bool didLoad = loader.TryLoadDataFromWebAsync().get();
|
||||||
|
@ -315,8 +314,8 @@ TEST_METHOD(LoadFromCache_Success)
|
||||||
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
VERIFY_IS_FALSE(loader.LoadedFromWeb());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(LoadFromWeb_Fail_WebException)
|
TEST_METHOD(LoadFromWeb_Fail_WebException)
|
||||||
{
|
{
|
||||||
CurrencyDataLoader loader(make_unique<MockCurrencyHttpClientThrowsException>(), L"en-US");
|
CurrencyDataLoader loader(make_unique<MockCurrencyHttpClientThrowsException>(), L"en-US");
|
||||||
|
|
||||||
bool didLoad = loader.TryLoadDataFromWebAsync().get();
|
bool didLoad = loader.TryLoadDataFromWebAsync().get();
|
||||||
|
@ -342,7 +341,6 @@ TEST_METHOD(LoadFromWeb_Success)
|
||||||
TEST_METHOD(Load_Success_LoadedFromCache)
|
TEST_METHOD(Load_Success_LoadedFromCache)
|
||||||
{
|
{
|
||||||
StandardCacheSetup();
|
StandardCacheSetup();
|
||||||
|
|
||||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||||
|
|
||||||
auto data_loaded_event = task_completion_event<void>();
|
auto data_loaded_event = task_completion_event<void>();
|
||||||
|
@ -391,7 +389,6 @@ TEST_CLASS(CurrencyConverterUnitTests){ const UCM::Unit GetUnit(const vector<UCM
|
||||||
TEST_METHOD(Loaded_LoadOrderedUnits)
|
TEST_METHOD(Loaded_LoadOrderedUnits)
|
||||||
{
|
{
|
||||||
StandardCacheSetup();
|
StandardCacheSetup();
|
||||||
|
|
||||||
CurrencyDataLoader loader(nullptr, L"en-US");
|
CurrencyDataLoader loader(nullptr, L"en-US");
|
||||||
|
|
||||||
auto data_loaded_event = task_completion_event<void>();
|
auto data_loaded_event = task_completion_event<void>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue