This commit is contained in:
Dhikshith 2023-08-06 20:08:41 +05:30
commit e479976030
10 changed files with 360 additions and 1673 deletions

1550
.github/fabricbot.json vendored

File diff suppressed because it is too large Load diff

135
.github/policies/resourceManagement.yml vendored Normal file
View file

@ -0,0 +1,135 @@
id:
name: GitOps.PullRequestIssueManagement
description: GitOps.PullRequestIssueManagement primitive
owner:
resource: repository
disabled: false
where:
configuration:
resourceManagementConfiguration:
scheduledSearches:
- description:
frequencies:
- hourly:
hour: 3
filters:
- isPullRequest
- isOpen
- hasLabel:
label: needs author feedback
- noActivitySince:
days: 7
- isNotLabeledWith:
label: no recent activity
actions:
- addLabel:
label: no recent activity
- addReply:
reply: This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **7 days**. Thank you for your contributions to Windows Calculator!
eventResponderTasks:
- if:
- payloadType: Issue_Comment
- hasLabel:
label: no recent activity
then:
- removeLabel:
label: no recent activity
description:
- if:
- payloadType: Issues
- isAction:
action: Closed
then:
- removeLabel:
label: needs pitch review
- removeLabel:
label: needs more info
- removeLabel:
label: needs spec
- removeLabel:
label: no recent activity
- removeLabel:
label: help wanted
- removeLabel:
label: needs spec review
- removeLabel:
label: needs spec
description:
triggerOnOwnActions: true
- if:
- payloadType: Pull_Request_Review
- isAction:
action: Submitted
- isReviewState:
reviewState: Changes_requested
then:
- addLabel:
label: needs author feedback
description:
- if:
- payloadType: Pull_Request
- isActivitySender:
issueAuthor: True
- not:
isAction:
action: Closed
- hasLabel:
label: needs author feedback
then:
- removeLabel:
label: needs author feedback
description:
- if:
- payloadType: Issue_Comment
- isActivitySender:
issueAuthor: True
- hasLabel:
label: needs author feedback
then:
- removeLabel:
label: needs author feedback
description:
- if:
- payloadType: Pull_Request_Review
- isActivitySender:
issueAuthor: True
- hasLabel:
label: needs author feedback
then:
- removeLabel:
label: needs author feedback
description:
- if:
- payloadType: Pull_Request
- not:
isAction:
action: Closed
- hasLabel:
label: no recent activity
then:
- removeLabel:
label: no recent activity
description:
- if:
- payloadType: Issue_Comment
- hasLabel:
label: no recent activity
then:
- removeLabel:
label: no recent activity
description:
- if:
- payloadType: Pull_Request_Review
- hasLabel:
label: no recent activity
then:
- removeLabel:
label: no recent activity
description:
- if:
- payloadType: Issue_Comment
then:
- cleanEmailReply
description:
onFailure:
onSuccess:

View file

@ -9,7 +9,7 @@ pr: none
variables: variables:
versionMajor: 11 versionMajor: 11
versionMinor: 2307 versionMinor: 2308
versionBuild: $[counter(format('{0}.{1}.*', variables['versionMajor'], variables['versionMinor']), 0)] versionBuild: $[counter(format('{0}.{1}.*', variables['versionMajor'], variables['versionMinor']), 0)]
versionPatch: 0 versionPatch: 0

View file

@ -3,9 +3,8 @@
<packageSources> <packageSources>
<clear /> <clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="Toolkit Labs" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources> </packageSources>
<disabledPackageSources> <disabledPackageSources>
<clear /> <clear />
</disabledPackageSources> </disabledPackageSources>
</configuration> </configuration>

View file

@ -107,6 +107,14 @@ CurrencyDataLoader::CurrencyDataLoader(_In_ unique_ptr<ICurrencyHttpClient> clie
if (GlobalizationPreferences::Languages->Size > 0) if (GlobalizationPreferences::Languages->Size > 0)
{ {
m_responseLanguage = GlobalizationPreferences::Languages->GetAt(0); m_responseLanguage = GlobalizationPreferences::Languages->GetAt(0);
// Workaround for Simplified Chinese localization issue of currency API.
std::wstring_view responseLanguage(m_responseLanguage->Data(), m_responseLanguage->Length());
std::match_results<std::wstring_view::const_iterator> match;
if (std::regex_match(responseLanguage.cbegin(), responseLanguage.cend(), match, std::wregex(L"zh-hans-[a-z]+", std::regex_constants::icase)))
{
m_responseLanguage = L"zh-CN";
}
} }
else else
{ {

View file

@ -793,9 +793,6 @@
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CommunityToolkit.Labs.Uwp.SettingsControls">
<Version>0.0.16</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform"> <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version> <Version>6.2.14</Version>
</PackageReference> </PackageReference>

View file

@ -4714,11 +4714,11 @@
<value>Appearance</value> <value>Appearance</value>
<comment>Subtitle of appearance setting on Settings page</comment> <comment>Subtitle of appearance setting on Settings page</comment>
</data> </data>
<data name="AppThemeExpander.Header" xml:space="preserve"> <data name="SettingsAppThemeTitle.Text" xml:space="preserve">
<value>App theme</value> <value>App theme</value>
<comment>Title of App theme expander</comment> <comment>Title of App theme expander</comment>
</data> </data>
<data name="AppThemeExpander.Description" xml:space="preserve"> <data name="SettingsAppThemeDescription.Text" xml:space="preserve">
<value>Select which app theme to display</value> <value>Select which app theme to display</value>
<comment>Description of App theme expander</comment> <comment>Description of App theme expander</comment>
</data> </data>

View file

@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:automation="using:CalculatorApp.ViewModel.Common.Automation" xmlns:automation="using:CalculatorApp.ViewModel.Common.Automation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:utils="using:CalculatorApp.Utils" xmlns:utils="using:CalculatorApp.Utils"
@ -15,7 +14,7 @@
<ResourceDictionary> <ResourceDictionary>
<Style x:Key="SettingsContentScrollViewStyle" TargetType="ScrollViewer"> <Style x:Key="SettingsContentScrollViewStyle" TargetType="ScrollViewer">
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/> <Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/> <Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="HorizontalScrollMode" Value="Disabled"/> <Setter Property="HorizontalScrollMode" Value="Disabled"/>
<Setter Property="IsHorizontalRailEnabled" Value="False"/> <Setter Property="IsHorizontalRailEnabled" Value="False"/>
@ -32,19 +31,11 @@
<Setter Property="TextWrapping" Value="Wrap"/> <Setter Property="TextWrapping" Value="Wrap"/>
</Style> </Style>
<Style x:Key="SettingsCategoryTitleTextBlockStyle"
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="Margin" Value="0,29,0,5"/>
</Style>
<automation:NarratorNotifier x:Name="NarratorNotifier"/> <automation:NarratorNotifier x:Name="NarratorNotifier"/>
<!-- Override default hyperlink button background color --> <!-- Override default hyperlink button background color -->
<StaticResource x:Key="HyperlinkButtonBackgroundPointerOver" ResourceKey="SubtleFillColorTransparentBrush"/> <StaticResource x:Key="HyperlinkButtonBackgroundPointerOver" ResourceKey="SubtleFillColorTransparentBrush"/>
<StaticResource x:Key="HyperlinkButtonBackgroundPressed" ResourceKey="SubtleFillColorTransparentBrush"/> <StaticResource x:Key="HyperlinkButtonBackgroundPressed" ResourceKey="SubtleFillColorTransparentBrush"/>
<x:Double x:Key="SettingsCardSpacing">3</x:Double>
</ResourceDictionary> </ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
@ -53,6 +44,42 @@
<RowDefinition Height="{x:Bind TitleBarHeight, Mode=OneWay}"/> <RowDefinition Height="{x:Bind TitleBarHeight, Mode=OneWay}"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="LayoutVisualStates">
<VisualState x:Name="LargeWideView">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="690"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ColumnAbout.Width" Value="324"/>
<Setter Target="AboutContentGrid.(Grid.Row)" Value="0"/>
<Setter Target="AboutContentGrid.(Grid.RowSpan)" Value="3"/>
<Setter Target="AboutContentGrid.(Grid.Column)" Value="1"/>
<Setter Target="AboutGroupTitle.Margin" Value="0"/>
<Setter Target="AboutContentGrid.Margin" Value="60,0,0,0"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="SideVisible">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="632"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="ColumnMain.Width" Value="*"/>
<Setter Target="ColumnAbout.Width" Value="*"/>
<Setter Target="AboutContentGrid.(Grid.Row)" Value="0"/>
<Setter Target="AboutContentGrid.(Grid.RowSpan)" Value="3"/>
<Setter Target="AboutContentGrid.(Grid.Column)" Value="1"/>
<Setter Target="AboutGroupTitle.Margin" Value="0"/>
<Setter Target="AboutContentGrid.Margin" Value="60,0,0,0"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="DefaultLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Button x:Name="BackButton" <Button x:Name="BackButton"
Grid.Row="0" Grid.Row="0"
@ -77,120 +104,160 @@
</Grid> </Grid>
<ScrollViewer Grid.Row="1" <ScrollViewer Grid.Row="1"
Margin="0,30,0,0" Margin="0,60,0,0"
Padding="24,0,24,16" Padding="24,0,24,16"
Style="{StaticResource SettingsContentScrollViewStyle}"> Style="{StaticResource SettingsContentScrollViewStyle}">
<Grid x:Name="ContentGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnMain" Width="*"/>
<ColumnDefinition x:Name="ColumnAbout" Width="0"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Spacing="{StaticResource SettingsCardSpacing}"> <Grid.RowDefinitions>
<StackPanel.ChildrenTransitions> <RowDefinition x:Name="AppearanceTitleRow" Height="Auto"/>
<EntranceThemeTransition FromVerticalOffset="50" IsStaggeringEnabled="True"/> <RowDefinition x:Name="AppearanceExpanderRow" Height="Auto"/>
<RepositionThemeTransition IsStaggeringEnabled="False"/> <RowDefinition x:Name="AboutTitleContentRow" Height="*"/>
</StackPanel.ChildrenTransitions> </Grid.RowDefinitions>
<TextBlock Style="{StaticResource SettingsCategoryTitleTextBlockStyle}"
<TextBlock Style="{StaticResource BodyStrongTextBlockStyle}"
AutomationProperties.HeadingLevel="Level1" AutomationProperties.HeadingLevel="Level1"
Text="{utils:ResourceString Name=SettingsAppearance/Text}"/> Text="{utils:ResourceString Name=SettingsAppearance/Text}"/>
<labs:SettingsExpander x:Name="AppThemeExpander"
Description="Select which app theme to display"
Header="App theme">
<labs:SettingsExpander.HeaderIcon>
<FontIcon Glyph="&#xE790;"/>
</labs:SettingsExpander.HeaderIcon>
<labs:SettingsExpander.Items>
<labs:SettingsCard ContentAlignment="Left">
<muxc:RadioButtons x:Name="ThemeRadioButtons"
Margin="0,-8,0,0"
SelectionChanged="OnThemeSelectionChanged">
<RadioButton x:Name="LightThemeRadioButton"
Content="{utils:ResourceString Name=LightThemeRadioButton/Content}"
Tag="Light"/>
<RadioButton x:Name="DarkThemeRadioButton"
Content="{utils:ResourceString Name=DarkThemeRadioButton/Content}"
Tag="Dark"/>
<RadioButton x:Name="SystemThemeRadioButton"
Content="{utils:ResourceString Name=SystemThemeRadioButton/Content}"
Tag="Default"/>
</muxc:RadioButtons>
</labs:SettingsCard>
</labs:SettingsExpander.Items>
</labs:SettingsExpander>
<TextBlock x:Name="AboutGroupTitle" <muxc:Expander x:Name="AppThemeExpander"
Style="{ThemeResource SettingsCategoryTitleTextBlockStyle}" Grid.Row="1"
AutomationProperties.HeadingLevel="Level1" Margin="0,8,0,0"
Text="{utils:ResourceString Name=AboutGroupTitle/Text}"/> HorizontalAlignment="Stretch"
<labs:SettingsExpander x:Name="AboutExpander"> VerticalAlignment="Top"
<labs:SettingsExpander.HeaderIcon> HorizontalContentAlignment="Left"
<BitmapIcon AutomationProperties.AccessibilityView="Raw" UriSource="ms-appx:///Assets/CalculatorAppList.png"/> AutomationProperties.Name="{utils:ResourceString Name=AppThemeExpander/[using:Windows.UI.Xaml.Automation]AutomationProperties/Name}"
</labs:SettingsExpander.HeaderIcon> ExpandDirection="Down"
<TextBlock x:Name="AboutBuildVersion" IsExpanded="False">
Foreground="{ThemeResource TextFillColorSecondaryBrush}" <muxc:Expander.Header>
IsTextSelectionEnabled="True"/> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
<labs:SettingsExpander.Items> <Grid.ColumnDefinitions>
<labs:SettingsCard ContentAlignment="Left"> <ColumnDefinition Width="Auto"/>
<StackPanel Margin="0,4,0,6" <ColumnDefinition Width="*"/>
Orientation="Vertical" </Grid.ColumnDefinitions>
Spacing="12">
<HyperlinkButton x:Name="AboutEULA" <FontIcon Margin="0,0,12,0"
Padding="0" VerticalAlignment="Center"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=529064" Foreground="{ThemeResource TextFillColorPrimaryBrush}"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=529064"> FontFamily="{ThemeResource CalculatorFontFamily}"
<TextBlock FontSize="{ThemeResource BodyFontSize}" FontSize="16"
Text="{utils:ResourceString Name=AboutEULA/Text}" Glyph="&#xE790;"/>
TextWrapping="Wrap"/>
</HyperlinkButton>
<HyperlinkButton x:Name="AboutControlServicesAgreement" <StackPanel Grid.Column="1"
Padding="0" Margin="0,12"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=822631" Orientation="Vertical">
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=822631"> <TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{utils:ResourceString Name=SettingsAppThemeTitle/Text}"/>
<TextBlock FontSize="{ThemeResource BodyFontSize}" <TextBlock Style="{StaticResource CaptionTextBlockStyle}"
Text="{utils:ResourceString Name=AboutControlServicesAgreement/Text}" Foreground="{ThemeResource TextFillColorSecondaryBrush}"
TextWrapping="Wrap"/> Text="{utils:ResourceString Name=SettingsAppThemeDescription/Text}"
</HyperlinkButton> TextWrapping="WrapWholeWords"/>
<HyperlinkButton x:Name="AboutControlPrivacyStatement"
Padding="0"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=521839"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=521839">
<TextBlock FontSize="{ThemeResource BodyFontSize}"
Text="{utils:ResourceString Name=AboutControlPrivacyStatement/Text}"
TextWrapping="Wrap"/>
</HyperlinkButton>
</StackPanel> </StackPanel>
</labs:SettingsCard> </Grid>
</labs:SettingsExpander.Items> </muxc:Expander.Header>
</labs:SettingsExpander> <muxc:Expander.Content>
<muxc:RadioButtons x:Name="ThemeRadioButtons"
Margin="32,0,0,0"
SelectionChanged="OnThemeSelectionChanged">
<RadioButton x:Name="LightThemeRadioButton"
Content="{utils:ResourceString Name=LightThemeRadioButton/Content}"
Tag="Light"/>
<RadioButton x:Name="DarkThemeRadioButton"
Content="{utils:ResourceString Name=DarkThemeRadioButton/Content}"
Tag="Dark"/>
<RadioButton x:Name="SystemThemeRadioButton"
Content="{utils:ResourceString Name=SystemThemeRadioButton/Content}"
Tag="Default"/>
</muxc:RadioButtons>
</muxc:Expander.Content>
</muxc:Expander>
<HyperlinkButton x:Name="FeedbackButton" <Grid x:Name="AboutContentGrid" Grid.Row="2">
MinWidth="120" <Grid.RowDefinitions>
Margin="-12,4,0,0" <RowDefinition Height="Auto"/>
HorizontalAlignment="Left" <RowDefinition Height="Auto"/>
VerticalAlignment="Top" <RowDefinition Height="Auto"/>
FontSize="{StaticResource BodyFontSize}" </Grid.RowDefinitions>
Click="FeedbackButton_Click"
Content="{utils:ResourceString Name=FeedbackButton/Content}"/>
<RichTextBlock x:Name="AboutContribute" <TextBlock x:Name="AboutGroupTitle"
Grid.Row="2" Margin="0,20,0,0"
Margin="1,9,0,0" Style="{ThemeResource BodyStrongTextBlockStyle}"
Style="{StaticResource SettingsRichTextBlockStyle}"> AutomationProperties.HeadingLevel="Level1"
<Paragraph> Text="{utils:ResourceString Name=AboutGroupTitle/Text}"/>
<!-- <StackPanel Grid.Row="1"
Note: don't put Hyperlink element start to the next line Margin="0,8,0,0"
otherwise unexpected whitespace will be add. Orientation="Vertical">
--> <RichTextBlock x:Name="AboutContentBody" Style="{StaticResource SettingsRichTextBlockStyle}">
<Run x:Name="ContributeRunBeforeLink"/><Hyperlink Foreground="{x:Bind AboutEULA.Foreground, Mode=OneWay}" <Paragraph>
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2099939" <Run x:Name="AboutBuildVersion"/>
TextDecorations="None" <LineBreak/>
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?linkid=2099939" <Run x:Name="AboutControlCopyrightRun"/>
UnderlineStyle="None"> </Paragraph>
<Run x:Name="ContributeRunLink"/> </RichTextBlock>
</Hyperlink><Run x:Name="ContributeRunAfterLink"/>
</Paragraph>
</RichTextBlock>
</StackPanel> <HyperlinkButton x:Name="AboutEULA"
Margin="0,16,0,0"
Padding="0"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=529064"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=529064">
<TextBlock FontSize="{ThemeResource BodyFontSize}"
Text="{utils:ResourceString Name=AboutEULA/Text}"
TextWrapping="Wrap"/>
</HyperlinkButton>
<HyperlinkButton x:Name="AboutControlServicesAgreement"
Margin="0,16,0,0"
Padding="0"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=822631"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=822631">
<TextBlock FontSize="{ThemeResource BodyFontSize}"
Text="{utils:ResourceString Name=AboutControlServicesAgreement/Text}"
TextWrapping="Wrap"/>
</HyperlinkButton>
<HyperlinkButton x:Name="AboutControlPrivacyStatement"
Margin="0,16,0,0"
Padding="0"
NavigateUri="https://go.microsoft.com/fwlink/?LinkID=521839"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?LinkID=521839">
<TextBlock FontSize="{ThemeResource BodyFontSize}"
Text="{utils:ResourceString Name=AboutControlPrivacyStatement/Text}"
TextWrapping="Wrap"/>
</HyperlinkButton>
<Button x:Name="FeedbackButton"
MinWidth="120"
Margin="0,24,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="{StaticResource BodyFontSize}"
Click="FeedbackButton_Click"
Content="{utils:ResourceString Name=FeedbackButton/Content}"/>
</StackPanel>
<RichTextBlock x:Name="AboutContribute"
Grid.Row="2"
Margin="0,16,0,0"
Style="{StaticResource SettingsRichTextBlockStyle}">
<Paragraph>
<!--
Note: don't put Hyperlink element start to the next line
otherwise unexpected whitespace will be add.
-->
<Run x:Name="ContributeRunBeforeLink"/>
<Hyperlink Foreground="{x:Bind AboutEULA.Foreground, Mode=OneWay}"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2099939"
TextDecorations="None"
ToolTipService.ToolTip="https://go.microsoft.com/fwlink/?linkid=2099939"
UnderlineStyle="None">
<Run x:Name="ContributeRunLink"/>
</Hyperlink>
<Run x:Name="ContributeRunAfterLink"/>
</Paragraph>
</RichTextBlock>
</Grid>
</Grid>
</ScrollViewer> </ScrollViewer>
</Grid> </Grid>
</UserControl> </UserControl>

View file

@ -45,7 +45,7 @@ namespace CalculatorApp
var copyrightText = var copyrightText =
LocalizationStringUtil.GetLocalizedString(resourceLoader.GetResourceString("AboutControlCopyright"), BUILD_YEAR); LocalizationStringUtil.GetLocalizedString(resourceLoader.GetResourceString("AboutControlCopyright"), BUILD_YEAR);
AboutExpander.Description = copyrightText; AboutControlCopyrightRun.Text = copyrightText;
InitializeContributeTextBlock(); InitializeContributeTextBlock();
} }
@ -108,8 +108,8 @@ namespace CalculatorApp
private void SetVersionString() private void SetVersionString()
{ {
PackageVersion version = Package.Current.Id.Version; PackageVersion version = Package.Current.Id.Version;
AboutExpander.Header = AppResourceProvider.GetInstance().GetResourceString("AppName"); string appName = AppResourceProvider.GetInstance().GetResourceString("AppName");
AboutBuildVersion.Text = version.Major + "." + version.Minor + "." + version.Build + "." + version.Revision; AboutBuildVersion.Text = appName + " " + version.Major + "." + version.Minor + "." + version.Build + "." + version.Revision;
} }
private void InitializeContributeTextBlock() private void InitializeContributeTextBlock()

View file

@ -316,8 +316,11 @@ namespace CalculatorUITests
Assert.AreEqual("square (9)", page.CalculatorResults.GetCalculatorExpressionText()); //verifies squared hotkey Assert.AreEqual("square (9)", page.CalculatorResults.GetCalculatorExpressionText()); //verifies squared hotkey
} }
// Ignore this test and add a new test KeyboardInput_PercentSquareRootBackspaceNegateOneZero below
// to avoid the issue of decimal keyboard input
[TestMethod] [TestMethod]
[Priority(1)] [Priority(1)]
[Ignore]
public void KeyboardInput_PercentSquareRootBackspaceDecimalNegateOneZero() public void KeyboardInput_PercentSquareRootBackspaceDecimalNegateOneZero()
{ {
//Verifies the %, square root, backspace, decimal, negate, 1, and 0 button //Verifies the %, square root, backspace, decimal, negate, 1, and 0 button
@ -345,6 +348,34 @@ namespace CalculatorUITests
Assert.AreEqual("9.9", page.CalculatorResults.GetCalculatorResultText()); //verifies calculation with decimal point and negative number Assert.AreEqual("9.9", page.CalculatorResults.GetCalculatorResultText()); //verifies calculation with decimal point and negative number
} }
[TestMethod]
[Priority(1)]
public void KeyboardInput_PercentSquareRootBackspaceNegateOneZero()
{
//Verifies the %, square root, backspace, negate, 1, and 0 button
CalculatorApp.EnsureCalculatorHasFocus();
CalculatorApp.Window.SendKeys("100");
CalculatorApp.Window.SendKeys(Keys.Backspace);
Assert.AreEqual("10", page.CalculatorResults.GetCalculatorResultText()); // verifies using the 1 key, the 0 key, and the backspace key
CalculatorApp.Window.SendKeys(Keys.Add);
CalculatorApp.EnsureCalculatorHasFocus();
CalculatorApp.Window.SendKeys(Keys.Shift + "5" + Keys.Shift);
Assert.AreEqual("1", page.CalculatorResults.GetCalculatorResultText()); //verifies percent calculation
Assert.AreEqual("10 + 1", page.CalculatorResults.GetCalculatorExpressionText()); //verifies percent hotkey
CalculatorApp.Window.SendKeys(Keys.Shift);
CalculatorApp.Window.SendKeys(Keys.Shift + "5" + Keys.Shift);
CalculatorApp.Window.SendKeys(Keys.Shift);
CalculatorApp.Window.SendKeys(Keys.Shift + "2" + Keys.Shift);
Assert.AreEqual("0.3162277660168379", page.CalculatorResults.GetCalculatorResultText()); //verifies square root calculation
Assert.AreEqual("10 + √(0.1)", page.CalculatorResults.GetCalculatorExpressionText()); //verifies 2√x hotkey
CalculatorApp.Window.SendKeys("1");
CalculatorApp.Window.SendKeys(Keys.Shift + "5" + Keys.Shift);
CalculatorApp.Window.SendKeys(Keys.F9);
Assert.AreEqual("-0.1", page.CalculatorResults.GetCalculatorResultText()); //verifies negate hotkey
page.StandardOperators.EqualButton.Click();
Assert.AreEqual("9.9", page.CalculatorResults.GetCalculatorResultText()); //verifies calculation with decimal point and negative number
}
[TestMethod] [TestMethod]
[Priority(1)] [Priority(1)]
public void KeyboardInput_MemoryHotkeys() public void KeyboardInput_MemoryHotkeys()