Skip to content

Commit

Permalink
Merge master into feature/GraphingCalculator branch (microsoft#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseartrivera authored Sep 5, 2019
1 parent 1c9755d commit 41fbcfe
Show file tree
Hide file tree
Showing 199 changed files with 5,706 additions and 2,822 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Prerequisites:
- Open [src\Calculator.sln](/src/Calculator.sln) in Visual Studio to build and run the Calculator app.
- For a general description of the Calculator project architecture see [ApplicationArchitecture.md](docs/ApplicationArchitecture.md).
- To run the UI Tests, you need to make sure that
[Windows Application Driver (WinAppDriver)](https://github.com/microsoft/WinAppDriver/releases/latest)
is installed.
## Contributing
Want to contribute? The team encourages community feedback and contributions. Please follow our [contributing guidelines](CONTRIBUTING.md).
Expand All @@ -52,25 +55,20 @@ For information regarding Windows Calculator plans and release schedule, please
Adding graphing calculator functionality [is on the project roadmap](https://github.com/Microsoft/calculator/issues/338) and we hope that this project can create a great end-user experience around graphing. To that end, the UI from the official in-box Windows Calculator is currently part of this repository, although the proprietary Microsoft-built graphing engine, which also drives graphing in Microsoft Mathematics and OneNote, is not. Community members can still be involved in the creation of the UI, however developer builds will not have graphing functionality due to the use of a [mock implementation of the engine](/src/MockGraphingImpl) built on top of a
[common graphing API](/src/GraphingInterfaces).
## Data / Telemetry
## Diagnostic Data
This project collects usage data and sends it to Microsoft to help improve our products and services.
Read our [privacy statement](https://go.microsoft.com/fwlink/?LinkId=521839) to learn more.
Telemetry is disabled in development builds by default, and can be enabled with the `SEND_TELEMETRY`
Diagnostic data is disabled in development builds by default, and can be enabled with the `SEND_DIAGNOSTICS`
build flag.
## Currency Converter
Windows Calculator includes a currency converter feature that uses mock data in developer builds. The data that
Microsoft uses for the currency converter feature (e.g., in the retail version of the application) is not licensed
for your use. The mock data will be clearly identifiable as it references planets instead of countries,
Windows Calculator includes a currency converter feature that uses mock data in developer builds. The data that
Microsoft uses for the currency converter feature (e.g., in the retail version of the application) is not licensed
for your use. The mock data will be clearly identifiable as it references planets instead of countries,
and remains static regardless of selected inputs.
## Reporting Security Issues
Security issues and bugs should be reported privately, via email, to the
Microsoft Security Response Center (MSRC) at <[secure@microsoft.com](mailto:secure@microsoft.com)>.
You should receive a response within 24 hours. If for some reason you do not, please follow up via
email to ensure we received your original message. Further information, including the
[MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in the
[Security TechCenter](https://technet.microsoft.com/en-us/security/default).
Please refer to [SECURITY.md](./SECURITY.md).
## License
Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
48 changes: 48 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.1 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all
source code repositories managed through our GitHub organizations, which include
[Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure),
[DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet),
[Xamarin](https://github.com/xamarin), and [many more](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets
Microsoft's [definition](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10))
of a security vulnerability, please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.** Instead, please
report them to the Microsoft Security Response Center at [secure@microsoft.com](mailto:secure@microsoft.com).
If possible, encrypt your message with our PGP key; please download it from the
[Microsoft Security Response Center PGP Key page](https://technet.microsoft.com/en-us/security/dn606155).

You should receive a response within 24 hours. If for some reason you do not, please follow up via
email to ensure we received your original message. Additional information can be found at
[microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better
understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of
[Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
4 changes: 2 additions & 2 deletions build/pipelines/azure-pipelines.release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pr: none

variables:
versionMajor: 10
versionMinor: 1906
versionBuild: $[counter('10.1906.*', 0)]
versionMinor: 1907
versionBuild: $[counter('10.1907.*', 0)]
versionPatch: 0

name: '$(versionMajor).$(versionMinor).$(versionBuild).$(versionPatch)'
Expand Down
2 changes: 1 addition & 1 deletion build/pipelines/templates/build-app-internal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
downloadDirectory: $(Build.SourcesDirectory)
vstsFeed: WindowsApps
vstsFeedPackage: calculator-internals
vstsPackageVersion: 0.0.11
vstsPackageVersion: 0.0.18

- template: ./build-single-architecture.yaml
parameters:
Expand Down
7 changes: 5 additions & 2 deletions build/pipelines/templates/package-appxbundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ jobs:
filePath: $(Build.SourcesDirectory)\build\scripts\CreateAppxBundleMapping.ps1
arguments: '-InputPath $(Build.ArtifactStagingDirectory)\drop\Release -ProjectName Calculator -OutputFile $(Build.BinariesDirectory)\AppxBundleMapping.txt'

- script: '"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\MakeAppx.exe" bundle /v /bv %BUNDLEVERSION% /f %MAPPINGFILEPATH% /p %OUTPUTPATH%'
- powershell: |
$buildVersion = [version]$Env:BUILDVERSION
$bundleVersion = "2020.$($buildVersion.Minor).$($buildVersion.Build).$($buildVersion.Revision)"
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86\MakeAppx.exe" bundle /v /bv $bundleVersion /f $Env:MAPPINGFILEPATH /p $Env:OUTPUTPATH
displayName: Make AppxBundle
env:
BUNDLEVERSION: $(Build.BuildNumber)
BUILDVERSION: $(Build.BuildNumber)
MAPPINGFILEPATH: $(Build.BinariesDirectory)\AppxBundleMapping.txt
OUTPUTPATH: $(Build.BinariesDirectory)\Microsoft.WindowsCalculator_8wekyb3d8bbwe.appxbundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
downloadDirectory: $(Build.SourcesDirectory)
vstsFeed: WindowsApps
vstsFeedPackage: calculator-internals
vstsPackageVersion: 0.0.11
vstsPackageVersion: 0.0.18

- task: PkgESStoreBrokerPackage@10
displayName: Create StoreBroker Packages
Expand Down
82 changes: 81 additions & 1 deletion docs/ManualTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,59 @@ Steps:
2. Select “miles” as the unit type in the output field
*Expected: The output starts with is “3.106856”*

### Always-on-Top

**Test 1**
Steps:
1. Launch the "Calculator" app and navigate to "Standard" Calculator
*Expected: Always-on-Top button's tooltip says "Keep on top"*
2. Click the Always-on-Top button
*Expected: Always-on-Top button's tooltip now says "Back to full view"*
3. Launch the "Notepad" app and put it in full-screen mode
*Expected: Calculator is still on top of Notepad and in Always-on-Top mode*

**Test 2**
Steps:
1. Launch the "Calculator" app and from "Standard" Calculator, input “3”, “+”, “3” (do not press “Enter”)
2. Tab over the Always-on-Top button and press "Enter" on the keyboard
*Expected: The application title, hamburger menu, calculator type title, calculation expression (the secondary line above the main display), history button and memory buttons are no longer visible. The main display shows "3"*
2. Press “Enter”
*Expected: The main display shows "6"*
3. Press "Ctrl-H" on the keyboard
*Expected: Nothing happens (history keyboard shortcuts are disabled)*
4. Press "Ctrl-P" on the keyboard, then tab over the Always-on-Top button and press "Enter" on the keyboard again
5. Open the Memory panel
*Expected: Nothing is stored in memory (memory keyboard shortcuts are disabled in Always-on-Top mode) and "6" is in history*

**Test 3**
Steps:
1. Launch the "Calculator" app and from "Standard" Calculator, click the Always-on-Top button
2. Resize the window horizontally
*Expected: The buttons automatically expand or shrink to fit the available screen size*
3. Resize the window vertically
*Expected: The buttons automatically expand or shrink to fit the available screen size and the percent, square-root, squared and reciprocal buttons disappear when the screen height is small*
4. Click the Always-on-Top button again
*Expected: Calculator is in Standard mode and the original window layout from before Step 1 is restored*
5. Click the Always-on-Top button again
*Expected: Calculator is in Always-on-Top mode and the window size from after Step 3 is restored*
6. Close the "Calculator" app
7. Launch the "Calculator" app again and click the Always-on-Top button
*Expected: The window size from right before closing from Always-on-Top mode (ie. after Step 5) is restored*

**Test 4**
Steps:
1. Launch the "Calculator" app and from "Standard" Calculator, click the Always-on-Top button
2. Input "/", "0", “Enter” on the keyboard
*Expected: "Result is undefined" is displayed in the system default app language*
3. Click the Always-on-Top button again
*Expected: Calculator is in Standard mode and all operator (except for "CE", "C", "Delete" and "=") and memory buttons are disabled

**Test 5**
Steps:
1. Launch the "Calculator" app and navigate to "Scientific" Calculator
*Expected: The Always-on-Top button is hidden*
2. Navigate to "Standard" Calculator
*Expected: The Always-on-Top button is visible*

## Basic Verification Tests

Expand Down Expand Up @@ -278,7 +331,7 @@ Steps:
Steps:
1. Launch the "Calculator" app.

For All Applicable Modes verify the following:
For All Applicable Modes verify the following (note: only 11-15 and 20 work in Always-on-Top mode):
2. Press **Alt +1** to Enter "Standard" mode
*Expected: Move to "Standard" screen.*
3. Press **Alt +2** to Enter "Scientific" mode
Expand Down Expand Up @@ -353,3 +406,30 @@ Steps:
61. Press **|** to Select 'Or'
62. Press **~** to Select 'Not'
63. Press **&** to Select 'And'

## Localization Tests

### Always-on-Top

**Test 1**
Steps:
1. Change the system default app language to Arabic
2. Launch the "Calculator" app and from "Standard" Calculator, click the Always-on-Top button
*Expected: UI/Menu is localized (for example, the title bar buttons is in right-to-left order)*
3. Input "/", "0", “Enter” on the keyboard
*Expected: Error message is in Arabic*

## Ease of Access Tests

### Always-on-Top

**Test 1**
Steps:
1. Open the "Narrator" app
2. Launch the "Calculator" app and from "Standard" Calculator, click the Always-on-Top button
3. Tab over the Always-on-Top button
*Expected: Narrator reads the localized version of "Back to full view"*
4. Tab over the main results field
*Expected: Narrator reads the localized version of exactly what's displayed (ie. "0")*
5. Tab over the rest of the UI elements
*Expected: Narrator reads the localized version of the UI elements' contents*
11 changes: 9 additions & 2 deletions src/CalcManager/CEngine/scicomm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ int CCalcEngine::GetCurrentRadix()
return m_radix;
}

wstring CCalcEngine::GetCurrentResultForRadix(uint32_t radix, int32_t precision)
wstring CCalcEngine::GetCurrentResultForRadix(uint32_t radix, int32_t precision, bool groupDigitsPerRadix)
{
Rational rat = (m_bRecord ? m_input.ToRational(m_radix, m_precision) : m_currentVal);

Expand All @@ -964,7 +964,14 @@ wstring CCalcEngine::GetCurrentResultForRadix(uint32_t radix, int32_t precision)
ChangeConstants(m_radix, m_precision);
}

return GroupDigitsPerRadix(numberString, radix);
if (groupDigitsPerRadix)
{
return GroupDigitsPerRadix(numberString, radix);
}
else
{
return numberString;
}
}

wstring CCalcEngine::GetStringForDisplay(Rational const& rat, uint32_t radix)
Expand Down
6 changes: 4 additions & 2 deletions src/CalcManager/CalcManager.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.18362.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<!-- This has to be exactly in this place for this to work -->
Expand Down Expand Up @@ -309,6 +309,7 @@
<ClInclude Include="Ratpack\CalcErr.h" />
<ClInclude Include="Ratpack\ratconst.h" />
<ClInclude Include="Ratpack\ratpak.h" />
<ClInclude Include="NumberFormattingUtils.h" />
<ClInclude Include="UnitConverter.h" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -349,6 +350,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="NumberFormattingUtils.cpp" />
<ClCompile Include="UnitConverter.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
4 changes: 3 additions & 1 deletion src/CalcManager/CalcManager.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<ClCompile Include="CEngine\RationalMath.cpp">
<Filter>CEngine</Filter>
</ClCompile>
<ClCompile Include="NumberFormattingUtils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Command.h" />
Expand Down Expand Up @@ -160,5 +161,6 @@
<ClInclude Include="Header Files\RationalMath.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="NumberFormattingUtils.h" />
</ItemGroup>
</Project>
</Project>
13 changes: 2 additions & 11 deletions src/CalcManager/CalculatorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ namespace CalculationManager
CCalcEngine::InitialOneTimeOnlySetup(*m_resourceProvider);
}

/// <summary>
/// Destructor for CalculatorManager
/// Ends two CCalcEngine
/// </summary>
CalculatorManager::~CalculatorManager()
{
this->MemorizedNumberClearAll();
}

/// <summary>
/// Call the callback function using passed in IDisplayHelper.
/// Used to set the primary display value on ViewModel
Expand Down Expand Up @@ -622,9 +613,9 @@ namespace CalculationManager
}
}

wstring CalculatorManager::GetResultForRadix(uint32_t radix, int32_t precision)
wstring CalculatorManager::GetResultForRadix(uint32_t radix, int32_t precision, bool groupDigitsPerRadix)
{
return m_currentCalculatorEngine ? m_currentCalculatorEngine->GetCurrentResultForRadix(radix, precision) : L"";
return m_currentCalculatorEngine ? m_currentCalculatorEngine->GetCurrentResultForRadix(radix, precision, groupDigitsPerRadix) : L"";
}

void CalculatorManager::SetPrecision(int32_t precision)
Expand Down
3 changes: 1 addition & 2 deletions src/CalcManager/CalculatorManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ namespace CalculationManager
void MemoryItemChanged(unsigned int indexOfMemory) override;

CalculatorManager(ICalcDisplay* displayCallback, IResourceProvider* resourceProvider);
~CalculatorManager();

void Reset(bool clearMemory = true);
void SetStandardMode();
Expand All @@ -125,7 +124,7 @@ namespace CalculationManager
}
void SetRadix(RADIX_TYPE iRadixType);
void SetMemorizedNumbersString();
std::wstring GetResultForRadix(uint32_t radix, int32_t precision);
std::wstring GetResultForRadix(uint32_t radix, int32_t precision, bool groupDigitsPerRadix);
void SetPrecision(int32_t precision);
void UpdateMaxIntDigits();
wchar_t DecimalSeparator();
Expand Down
Loading

0 comments on commit 41fbcfe

Please sign in to comment.