Merge master into feature/GraphingCalculator branch (#585)
* Merge master into feature/GraphingCalculator branch
This commit is contained in:
parent
1475b49120
commit
a418777f02
99
.clang-format
Normal file
99
.clang-format
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: AlwaysBreak
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: true
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
BreakBeforeBinaryOperators: NonAssignment
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
BreakBeforeInheritanceComma: false
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
BreakAfterJavaFieldAnnotations: true
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 160
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
CompactNamespaces: true
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: false
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^<ext/.*\.h>'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '^<.*\.h>'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 3
|
||||||
|
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
JavaScriptQuotes: Single
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: All
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReflowComments: true
|
||||||
|
SortIncludes: false
|
||||||
|
SortUsingDeclarations: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Cpp11
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
#...
|
||||||
|
# unsupported rules
|
||||||
|
#BreakInheritanceList: AfterColon
|
||||||
|
#Language: None
|
||||||
|
#ObjCBinPackProtocolList: Auto
|
||||||
|
#PenaltyBreakTemplateDeclaration: 10
|
||||||
|
#SpaceBeforeCpp11BracedList: false
|
||||||
|
#SpaceBeforeCtorInitializerColon: true
|
||||||
|
#SpaceBeforeInheritanceColon: true
|
||||||
|
#SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
|
23
.gitattributes
vendored
23
.gitattributes
vendored
@ -12,29 +12,6 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
*.cs diff=csharp
|
*.cs diff=csharp
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Set the merge driver for project and solution files
|
|
||||||
#
|
|
||||||
# Merging from the command prompt will add diff markers to the files if there
|
|
||||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
|
||||||
# the diff markers are never inserted). Diff markers may cause the following
|
|
||||||
# file extensions to fail to load in VS. An alternative would be to treat
|
|
||||||
# these files as binary and thus will always conflict and require user
|
|
||||||
# intervention with every merge. To do so, just uncomment the entries below
|
|
||||||
###############################################################################
|
|
||||||
*.sln merge=binary
|
|
||||||
*.csproj merge=binary
|
|
||||||
*.vbproj merge=binary
|
|
||||||
*.vcxproj merge=binary
|
|
||||||
*.vcproj merge=binary
|
|
||||||
*.dbproj merge=binary
|
|
||||||
*.fsproj merge=binary
|
|
||||||
*.lsproj merge=binary
|
|
||||||
*.wixproj merge=binary
|
|
||||||
*.modelproj merge=binary
|
|
||||||
*.sqlproj merge=binary
|
|
||||||
*.wwaproj merge=binary
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# behavior for image files
|
# behavior for image files
|
||||||
#
|
#
|
||||||
|
10
.github/ISSUE_TEMPLATE/bug_report.md
vendored
10
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -48,3 +48,13 @@ Run the following commands in Powershell and copy/paste the output.
|
|||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
<!-- Add any other context about the problem here. -->
|
<!-- Add any other context about the problem here. -->
|
||||||
|
|
||||||
|
**Requested Assignment**
|
||||||
|
<!--
|
||||||
|
Some people just want to report a bug and let someone else fix it.
|
||||||
|
Other people want to not only submit the bug report, but fix it as well.
|
||||||
|
Both scenarios are completely ok. We just want to know which one it is.
|
||||||
|
Please indicate which bucket you fall into by keeping one and removing the other.
|
||||||
|
-->
|
||||||
|
If possible, I would like to fix this.
|
||||||
|
I'm just reporting this problem. I don't want to fix it.
|
||||||
|
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -41,3 +41,14 @@ Things we are explicitly not doing or supporting or that are out of scope, inclu
|
|||||||
<!--
|
<!--
|
||||||
Show as much of the experience as needed to explain the idea. This can be as simple as a napkin drawing but can also be a code prototype, or a design comp. Keep it simple at this stage, as it can be refined later during the pre-production stage.
|
Show as much of the experience as needed to explain the idea. This can be as simple as a napkin drawing but can also be a code prototype, or a design comp. Keep it simple at this stage, as it can be refined later during the pre-production stage.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
**Requested Assignment**
|
||||||
|
<!--
|
||||||
|
Some people just want to suggest a feature and let someone else implement it.
|
||||||
|
Other people want to not only suggest a feature, but implement it as well.
|
||||||
|
Both scenarios are completely ok. We just want to know which one it is.
|
||||||
|
We are likely to prioritize the review of feature requests if they already have someone who can implement them.
|
||||||
|
Please indicate which bucket you fall into by keeping one and removing the other.
|
||||||
|
-->
|
||||||
|
If possible, I would like to implement this.
|
||||||
|
I'm just suggesting this idea. I don't want to implement it.
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -290,6 +290,7 @@ __pycache__/
|
|||||||
# Calculator specific
|
# Calculator specific
|
||||||
Generated Files/
|
Generated Files/
|
||||||
src/GraphControl/GraphingImplOverrides.props
|
src/GraphControl/GraphingImplOverrides.props
|
||||||
|
src/CalcViewModel/DataLoaders/DataLoaderConstants.h
|
||||||
!/build/config/TRexDefs/**
|
!/build/config/TRexDefs/**
|
||||||
!src/Calculator/TemporaryKey.pfx
|
!src/Calculator/TemporaryKey.pfx
|
||||||
!src/CalculatorUnitTests/CalculatorUnitTests_TemporaryKey.pfx
|
!src/CalculatorUnitTests/CalculatorUnitTests_TemporaryKey.pfx
|
208
NOTICE.txt
208
NOTICE.txt
@ -37,3 +37,211 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Appium DotNet Driver
|
||||||
|
|
||||||
|
Copyright 2014-2015 Appium Contributors
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
@ -16,6 +16,9 @@ Calculator ships regularly with new features and bug fixes. You can get the late
|
|||||||
- Calculation history and memory capabilities.
|
- Calculation history and memory capabilities.
|
||||||
- Conversion between many units of measurement.
|
- Conversion between many units of measurement.
|
||||||
- Currency conversion based on data retrieved from [Bing](https://www.bing.com).
|
- Currency conversion based on data retrieved from [Bing](https://www.bing.com).
|
||||||
|
- [Infinite precision](https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic) for basic
|
||||||
|
arithmetic operations (addition, subtraction, multiplication, division) so that calculations
|
||||||
|
never lose precision.
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
@ -55,6 +58,12 @@ Read our [privacy statement](https://go.microsoft.com/fwlink/?LinkId=521839) to
|
|||||||
Telemetry is disabled in development builds by default, and can be enabled with the `SEND_TELEMETRY`
|
Telemetry is disabled in development builds by default, and can be enabled with the `SEND_TELEMETRY`
|
||||||
build flag.
|
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,
|
||||||
|
and remains static regardless of selected inputs.
|
||||||
|
|
||||||
## Reporting Security Issues
|
## Reporting Security Issues
|
||||||
Security issues and bugs should be reported privately, via email, to the
|
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)>.
|
Microsoft Security Response Center (MSRC) at <[secure@microsoft.com](mailto:secure@microsoft.com)>.
|
||||||
|
91
Tools/Scripts/clang-format/clang-format-all.ps1
Normal file
91
Tools/Scripts/clang-format/clang-format-all.ps1
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<#
|
||||||
|
.DESCRIPTION
|
||||||
|
Helper script to format all header and source files in the repository.
|
||||||
|
|
||||||
|
By default, the script will recursively search under the repo root for
|
||||||
|
files to format. Users can give explicit parameters indicating how the
|
||||||
|
search should include and exclude filetypes.
|
||||||
|
|
||||||
|
If users don't want the search functionality, they can instead provide
|
||||||
|
an explicit list of files to format.
|
||||||
|
|
||||||
|
.PARAMETER RepoRoot
|
||||||
|
Full path to the root of the repository which is the target of the search.
|
||||||
|
Will default to the root of the current working directory.
|
||||||
|
|
||||||
|
.PARAMETER Include
|
||||||
|
Array of filetype extensions to target for formatting.
|
||||||
|
By default, targets standard extensions for header and source files.
|
||||||
|
Follows the same rules as the -Include parameter for Get-ChildItem.
|
||||||
|
|
||||||
|
.PARAMETER Exclude
|
||||||
|
Array of filetype extensions to exclude from formatting.
|
||||||
|
By default, excludes generated XAML files.
|
||||||
|
Follows the same rules as the -Exclude paramter for Get-ChildItem.
|
||||||
|
|
||||||
|
.PARAMETER Files
|
||||||
|
Array of files to format. The script will exit if one of the provided
|
||||||
|
filepaths does not exist.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\clang-format-all.ps1
|
||||||
|
|
||||||
|
Formats all header and source files under the repository root.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\clang-format-all.ps1 -RepoRoot 'S:\repos\calculator' -Include '*.h', '*.cpp' -Exclude '*.g.*'
|
||||||
|
|
||||||
|
Formats all *.h and *.cpp files under 'S:\repos\calculator', excluding files with an extension
|
||||||
|
like *.g.*
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\clang-format-all.ps1 -File 'S:\repos\calculator\src\CalcViewModel\UnitConverterViewModel.h', 'S:\repos\calculator\src\CalcViewModel\MemoryItemViewModel.cpp'
|
||||||
|
|
||||||
|
Formats the specified files.
|
||||||
|
#>
|
||||||
|
[CmdletBinding( DefaultParameterSetName = 'Search' )]
|
||||||
|
param(
|
||||||
|
[Parameter( ParameterSetName = 'Search' )]
|
||||||
|
[ValidateScript({ Test-Path -PathType Container -Path $_ })]
|
||||||
|
[string] $RepoRoot = "$( git rev-parse --show-toplevel )",
|
||||||
|
|
||||||
|
[Parameter( ParameterSetName = 'Search' )]
|
||||||
|
[string[]] $Include = ( '*.h', '*.hh', '*.hpp', '*.c', '*.cc', '*.cpp' ),
|
||||||
|
|
||||||
|
[Parameter( ParameterSetName = 'Search' )]
|
||||||
|
[string[]] $Exclude = '*.g.*',
|
||||||
|
|
||||||
|
[Parameter(
|
||||||
|
ParameterSetName = 'Explicit',
|
||||||
|
Mandatory)]
|
||||||
|
[ValidateScript({
|
||||||
|
$_ | Where-Object { -not (Test-Path -PathType Leaf -Path $_) } |
|
||||||
|
ForEach-Object { throw "Could not find file: [$_]" }
|
||||||
|
|
||||||
|
return $true
|
||||||
|
})]
|
||||||
|
[string[]] $Files
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($PSCmdlet.ParameterSetName -eq 'Explicit')
|
||||||
|
{
|
||||||
|
# Use the file paths we were given.
|
||||||
|
$targetFiles = @($Files)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Gather the files to be formatted.
|
||||||
|
$targetFiles = @(
|
||||||
|
Get-ChildItem -Recurse -Path $RepoRoot -Include $Include -Exclude $Exclude |
|
||||||
|
Select-Object -ExpandProperty FullName
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Format the files.
|
||||||
|
$formatParams = @(
|
||||||
|
'-i' # In-place
|
||||||
|
'-style=file' # Search for a .clang-format file in the parent directory of the source file.
|
||||||
|
'-verbose'
|
||||||
|
)
|
||||||
|
|
||||||
|
clang-format $formatParams $targetFiles
|
53
Tools/Scripts/clang-format/clang-format-all.sh
Normal file
53
Tools/Scripts/clang-format/clang-format-all.sh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "Usage: $0 DIR..."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Variable that will hold the name of the clang-format command
|
||||||
|
FMT=""
|
||||||
|
|
||||||
|
# Some distros just call it clang-format. Others (e.g. Ubuntu) are insistent
|
||||||
|
# that the version number be part of the command. We prefer clang-format if
|
||||||
|
# that's present, otherwise we work backwards from highest version to lowest
|
||||||
|
# version.
|
||||||
|
for clangfmt in clang-format{,-{4,3}.{9,8,7,6,5,4,3,2,1,0}}; do
|
||||||
|
if which "$clangfmt" &>/dev/null; then
|
||||||
|
FMT="$clangfmt"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if we found a working clang-format
|
||||||
|
if [ -z "$FMT" ]; then
|
||||||
|
echo "failed to find clang-format"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SRC_PATH="$@"
|
||||||
|
if [ -z "$SRC_PATH" ]; then
|
||||||
|
SRC_PATH="../../../src"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check all of the arguments first to make sure they're all directories
|
||||||
|
for dir in "$SRC_PATH"; do
|
||||||
|
if [ ! -d "${dir}" ]; then
|
||||||
|
echo "${dir} is not a directory"
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Run clang-format -i on all of the things
|
||||||
|
for dir in "$SRC_PATH"; do
|
||||||
|
pushd "${dir}" &>/dev/null
|
||||||
|
find . \
|
||||||
|
\( -name '*.c' \
|
||||||
|
-o -name '*.cc' \
|
||||||
|
-o -name '*.cpp' \
|
||||||
|
-o -name '*.h' \
|
||||||
|
-o -name '*.hh' \
|
||||||
|
-o -name '*.hpp' \) \
|
||||||
|
-exec "${FMT}" -style=file -i '{}' \;
|
||||||
|
popd &>/dev/null
|
||||||
|
done
|
@ -1,5 +1,5 @@
|
|||||||
<SignConfigXML>
|
<SignConfigXML>
|
||||||
<job platform="" configuration="" certSubject="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" jobname="EngFunSimpleSign" approvers="gstolt;vigarg">
|
<job platform="" configuration="" certSubject="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" jobname="EngFunSimpleSign" approvers="">
|
||||||
<file src="__INPATHROOT__\Microsoft.WindowsCalculator_8wekyb3d8bbwe.appxbundle" signType="136020001" dest="__OUTPATHROOT__\Microsoft.WindowsCalculator_8wekyb3d8bbwe.appxbundle" />
|
<file src="__INPATHROOT__\Microsoft.WindowsCalculator_8wekyb3d8bbwe.appxbundle" signType="136020001" dest="__OUTPATHROOT__\Microsoft.WindowsCalculator_8wekyb3d8bbwe.appxbundle" />
|
||||||
</job>
|
</job>
|
||||||
</SignConfigXML>
|
</SignConfigXML>
|
@ -33,6 +33,11 @@ jobs:
|
|||||||
platform: ARM64
|
platform: ARM64
|
||||||
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
|
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
|
||||||
|
|
||||||
|
- template: ./templates/run-ui-tests.yaml
|
||||||
|
parameters:
|
||||||
|
platform: x64
|
||||||
|
runsettingsFileName: CalculatorUITests.ci.runsettings
|
||||||
|
|
||||||
- template: ./templates/run-unit-tests.yaml
|
- template: ./templates/run-unit-tests.yaml
|
||||||
parameters:
|
parameters:
|
||||||
platform: x64
|
platform: x64
|
||||||
|
@ -9,8 +9,8 @@ pr: none
|
|||||||
|
|
||||||
variables:
|
variables:
|
||||||
versionMajor: 10
|
versionMajor: 10
|
||||||
versionMinor: 1904
|
versionMinor: 1906
|
||||||
versionBuild: $[counter('10.1904.*', 0)]
|
versionBuild: $[counter('10.1906.*', 0)]
|
||||||
versionPatch: 0
|
versionPatch: 0
|
||||||
|
|
||||||
name: '$(versionMajor).$(versionMinor).$(versionBuild).$(versionPatch)'
|
name: '$(versionMajor).$(versionMinor).$(versionBuild).$(versionPatch)'
|
||||||
@ -35,6 +35,16 @@ jobs:
|
|||||||
platform: ARM64
|
platform: ARM64
|
||||||
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
|
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
|
||||||
|
|
||||||
|
- template: ./templates/run-ui-tests.yaml
|
||||||
|
parameters:
|
||||||
|
platform: x64
|
||||||
|
runsettingsFileName: CalculatorUITests.release.runsettings
|
||||||
|
|
||||||
|
- template: ./templates/run-ui-tests.yaml
|
||||||
|
parameters:
|
||||||
|
platform: x86
|
||||||
|
runsettingsFileName: CalculatorUITests.release.runsettings
|
||||||
|
|
||||||
- template: ./templates/run-unit-tests.yaml
|
- template: ./templates/run-unit-tests.yaml
|
||||||
parameters:
|
parameters:
|
||||||
platform: x64
|
platform: x64
|
||||||
|
@ -12,7 +12,7 @@ jobs:
|
|||||||
displayName: Build ${{ parameters.platform }}
|
displayName: Build ${{ parameters.platform }}
|
||||||
condition: ${{ parameters.condition }}
|
condition: ${{ parameters.condition }}
|
||||||
pool:
|
pool:
|
||||||
vmImage: vs2017-win2016
|
vmImage: windows-2019
|
||||||
variables:
|
variables:
|
||||||
BuildConfiguration: Release
|
BuildConfiguration: Release
|
||||||
BuildPlatform: ${{ parameters.platform }}
|
BuildPlatform: ${{ parameters.platform }}
|
||||||
@ -29,7 +29,7 @@ jobs:
|
|||||||
downloadDirectory: $(Build.SourcesDirectory)
|
downloadDirectory: $(Build.SourcesDirectory)
|
||||||
vstsFeed: WindowsApps
|
vstsFeed: WindowsApps
|
||||||
vstsFeedPackage: calculator-internals
|
vstsFeedPackage: calculator-internals
|
||||||
vstsPackageVersion: 0.0.10
|
vstsPackageVersion: 0.0.11
|
||||||
|
|
||||||
- template: ./build-single-architecture.yaml
|
- template: ./build-single-architecture.yaml
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -10,7 +10,7 @@ jobs:
|
|||||||
displayName: Build ${{ parameters.platform }}
|
displayName: Build ${{ parameters.platform }}
|
||||||
condition: ${{ parameters.condition }}
|
condition: ${{ parameters.condition }}
|
||||||
pool:
|
pool:
|
||||||
vmImage: vs2017-win2016
|
vmImage: windows-2019
|
||||||
variables:
|
variables:
|
||||||
BuildConfiguration: Release
|
BuildConfiguration: Release
|
||||||
BuildPlatform: ${{ parameters.platform }}
|
BuildPlatform: ${{ parameters.platform }}
|
||||||
|
@ -6,9 +6,9 @@ parameters:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- task: NuGetToolInstaller@0
|
- task: NuGetToolInstaller@0
|
||||||
displayName: Use NuGet 4.7.1
|
displayName: Use NuGet 5.0.2
|
||||||
inputs:
|
inputs:
|
||||||
versionSpec: 4.7.1
|
versionSpec: 5.0.2
|
||||||
checkLatest: true
|
checkLatest: true
|
||||||
|
|
||||||
# In most accounts, you can just use 'NuGetCommand' instead of this GUID.
|
# In most accounts, you can just use 'NuGetCommand' instead of this GUID.
|
||||||
@ -29,8 +29,8 @@ steps:
|
|||||||
displayName: 'Build solution src/Calculator.sln'
|
displayName: 'Build solution src/Calculator.sln'
|
||||||
inputs:
|
inputs:
|
||||||
solution: src/Calculator.sln
|
solution: src/Calculator.sln
|
||||||
vsVersion: 15.0
|
vsVersion: 16.0
|
||||||
msbuildArgs: /bl:$(Build.BinariesDirectory)\$(BuildConfiguration)\$(BuildPlatform)\Calculator.binlog /p:OutDir=$(Build.BinariesDirectory)\$(BuildConfiguration)\$(BuildPlatform)\ /p:GenerateProjectSpecificOutputFolder=true /p:AppVersion=$(Build.BuildNumber) ${{ parameters.extraMsBuildArgs }}
|
msbuildArgs: /bl:$(Build.BinariesDirectory)\$(BuildConfiguration)\$(BuildPlatform)\Calculator.binlog /p:OutDir=$(Build.BinariesDirectory)\$(BuildConfiguration)\$(BuildPlatform)\ /p:GenerateProjectSpecificOutputFolder=true /p:AppVersion=$(Build.BuildNumber) /t:Publish /p:PublishDir=$(Build.BinariesDirectory)\$(BuildConfiguration)\$(BuildPlatform)\publish\ ${{ parameters.extraMsBuildArgs }}
|
||||||
platform: $(BuildPlatform)
|
platform: $(BuildPlatform)
|
||||||
configuration: $(BuildConfiguration)
|
configuration: $(BuildConfiguration)
|
||||||
clean: true
|
clean: true
|
||||||
|
@ -17,7 +17,7 @@ jobs:
|
|||||||
in(dependencies.BuildARM64.result, 'Succeeded', 'SucceededWithIssues', 'Skipped')
|
in(dependencies.BuildARM64.result, 'Succeeded', 'SucceededWithIssues', 'Skipped')
|
||||||
)
|
)
|
||||||
pool:
|
pool:
|
||||||
vmImage: vs2017-win2016
|
vmImage: windows-2019
|
||||||
workspace:
|
workspace:
|
||||||
clean: outputs
|
clean: outputs
|
||||||
variables:
|
variables:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# This template contains a job which builds artifacts needed to release the app to the store and to
|
# This template contains a job which builds artifacts needed to release the app to the store and to
|
||||||
# Windows using Microsoft-internal systems. It relies Microsoft-internal resources and will not
|
# Windows using Microsoft-internal systems. It relies on Microsoft-internal resources and will not
|
||||||
# work outside of Microsoft.
|
# work outside of Microsoft.
|
||||||
# Specifically, this job:
|
# Specifically, this job:
|
||||||
# - Signs the bundle using a secure system. If you want to build your own, use SignTool following
|
# - Signs the bundle using a secure system. If you want to build your own, use SignTool following
|
||||||
@ -28,8 +28,8 @@ jobs:
|
|||||||
- task: PkgESSetupBuild@10
|
- task: PkgESSetupBuild@10
|
||||||
displayName: Initialize Package ES
|
displayName: Initialize Package ES
|
||||||
inputs:
|
inputs:
|
||||||
productName: Calculator
|
productName: Calculator
|
||||||
disableWorkspace: true
|
disableWorkspace: true
|
||||||
env:
|
env:
|
||||||
XES_DISABLEPROV: true
|
XES_DISABLEPROV: true
|
||||||
|
|
||||||
@ -46,6 +46,8 @@ jobs:
|
|||||||
|
|
||||||
- task: PkgESCodeSign@10
|
- task: PkgESCodeSign@10
|
||||||
displayName: Send bundle to Package ES code signing service
|
displayName: Send bundle to Package ES code signing service
|
||||||
|
env:
|
||||||
|
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||||
inputs:
|
inputs:
|
||||||
signConfigXml: build\config\SignConfig.xml
|
signConfigXml: build\config\SignConfig.xml
|
||||||
inPathRoot: $(Build.ArtifactStagingDirectory)\appxBundle
|
inPathRoot: $(Build.ArtifactStagingDirectory)\appxBundle
|
||||||
@ -60,25 +62,25 @@ jobs:
|
|||||||
- task: CopyFiles@2
|
- task: CopyFiles@2
|
||||||
displayName: Copy signed AppxBundle to vpack staging folder
|
displayName: Copy signed AppxBundle to vpack staging folder
|
||||||
inputs:
|
inputs:
|
||||||
sourceFolder: $(Build.ArtifactStagingDirectory)\appxBundleSigned
|
sourceFolder: $(Build.ArtifactStagingDirectory)\appxBundleSigned
|
||||||
targetFolder: $(Build.ArtifactStagingDirectory)\vpack\appxBundle
|
targetFolder: $(Build.ArtifactStagingDirectory)\vpack\appxBundle
|
||||||
|
|
||||||
- task: PkgESVPack@10
|
- task: PkgESVPack@10
|
||||||
displayName: Create and push vpack for app
|
displayName: Create and push vpack for app
|
||||||
env:
|
env:
|
||||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||||
inputs:
|
inputs:
|
||||||
sourceDirectory: $(Build.ArtifactStagingDirectory)\vpack\appxBundle
|
sourceDirectory: $(Build.ArtifactStagingDirectory)\vpack\appxBundle
|
||||||
description: VPack for the Calculator Application
|
description: VPack for the Calculator Application
|
||||||
pushPkgName: calculator.app
|
pushPkgName: calculator.app
|
||||||
version: $(versionMajor).$(versionMinor).$(versionBuild)
|
version: $(versionMajor).$(versionMinor).$(versionBuild)
|
||||||
owner: paxeeapps
|
owner: paxeeapps
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
displayName: Publish vpack\app artifact with vpack manifest
|
displayName: Publish vpack\app artifact with vpack manifest
|
||||||
inputs:
|
inputs:
|
||||||
pathtoPublish: $(XES_VPACKMANIFESTDIRECTORY)\$(XES_VPACKMANIFESTNAME)
|
pathtoPublish: $(XES_VPACKMANIFESTDIRECTORY)\$(XES_VPACKMANIFESTNAME)
|
||||||
artifactName: vpack\app
|
artifactName: vpack\app
|
||||||
|
|
||||||
# TODO (macool): create and push internal test packages and test config
|
# TODO (macool): create and push internal test packages and test config
|
||||||
|
|
||||||
@ -89,7 +91,7 @@ jobs:
|
|||||||
downloadDirectory: $(Build.SourcesDirectory)
|
downloadDirectory: $(Build.SourcesDirectory)
|
||||||
vstsFeed: WindowsApps
|
vstsFeed: WindowsApps
|
||||||
vstsFeedPackage: calculator-internals
|
vstsFeedPackage: calculator-internals
|
||||||
vstsPackageVersion: 0.0.10
|
vstsPackageVersion: 0.0.11
|
||||||
|
|
||||||
- task: PkgESStoreBrokerPackage@10
|
- task: PkgESStoreBrokerPackage@10
|
||||||
displayName: Create StoreBroker Packages
|
displayName: Create StoreBroker Packages
|
||||||
|
50
build/pipelines/templates/run-ui-tests.yaml
Normal file
50
build/pipelines/templates/run-ui-tests.yaml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# This template contains jobs to run UI tests using WinAppDriver.
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
platform: ''
|
||||||
|
runsettingsFileName: ''
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: UITests${{ parameters.platform }}
|
||||||
|
displayName: UITests ${{ parameters.platform }}
|
||||||
|
dependsOn: Build${{ parameters.platform }}
|
||||||
|
condition: succeeded()
|
||||||
|
pool:
|
||||||
|
vmImage: windows-2019
|
||||||
|
variables:
|
||||||
|
skipComponentGovernanceDetection: true
|
||||||
|
steps:
|
||||||
|
- checkout: none
|
||||||
|
|
||||||
|
- powershell: Set-DisplayResolution -Width 1920 -Height 1080 -Force
|
||||||
|
displayName: Set resolution to 1920x1080
|
||||||
|
continueOnError: true
|
||||||
|
|
||||||
|
- task: DownloadBuildArtifacts@0
|
||||||
|
displayName: Download AppxBundle and CalculatorUITests
|
||||||
|
inputs:
|
||||||
|
artifactName: drop
|
||||||
|
itemPattern: |
|
||||||
|
drop/Release/${{ parameters.platform }}/Calculator/AppPackages/**
|
||||||
|
drop/Release/${{ parameters.platform }}/publish/**
|
||||||
|
|
||||||
|
- task: PowerShell@2
|
||||||
|
displayName: Install certificate
|
||||||
|
inputs:
|
||||||
|
filePath: $(Build.ArtifactStagingDirectory)/drop/Release/${{ parameters.platform }}/Calculator/AppPackages/Calculator_$(Build.BuildNumber)_Test/Add-AppDevPackage.ps1
|
||||||
|
arguments: -CertificatePath $(Build.ArtifactStagingDirectory)/drop/Release/${{ parameters.platform }}/Calculator/AppPackages/Calculator_$(Build.BuildNumber)_Test/Calculator_$(Build.BuildNumber)_${{ parameters.platform }}.cer -Force
|
||||||
|
|
||||||
|
- task: PowerShell@2
|
||||||
|
displayName: Install app
|
||||||
|
inputs:
|
||||||
|
filePath: $(Build.ArtifactStagingDirectory)/drop/Release/${{ parameters.platform }}/Calculator/AppPackages/Calculator_$(Build.BuildNumber)_Test/Add-AppDevPackage.ps1
|
||||||
|
arguments: -Force
|
||||||
|
|
||||||
|
- task: VSTest@2
|
||||||
|
displayName: Run CalculatorUITests
|
||||||
|
inputs:
|
||||||
|
testAssemblyVer2: $(Build.ArtifactStagingDirectory)/drop/Release/${{ parameters.platform }}/publish/CalculatorUITests.dll
|
||||||
|
vsTestVersion: 16.0
|
||||||
|
runSettingsFile: $(Build.ArtifactStagingDirectory)/drop/Release/${{ parameters.platform }}/publish/${{ parameters.runsettingsFileName }}
|
||||||
|
platform: ${{ parameters.platform }}
|
||||||
|
configuration: Release
|
@ -153,7 +153,9 @@ The CalcEngine contains the logic for interpreting and performing operations acc
|
|||||||
|
|
||||||
### RatPack
|
### RatPack
|
||||||
|
|
||||||
The RatPack (short for Rational Pack) is the core of the Calculator model and contains the logic for performing its mathematical operations. The interface to this layer is defined in [ratpak.h][ratpak.h].
|
The RatPack (short for Rational Pack) is the core of the Calculator model and contains the logic for
|
||||||
|
performing its mathematical operations (using [infinite precision][Infinite Precision] arithmetic
|
||||||
|
instead of regular floating point arithmetic). The interface to this layer is defined in [ratpak.h][ratpak.h].
|
||||||
|
|
||||||
[References]:####################################################################################################
|
[References]:####################################################################################################
|
||||||
|
|
||||||
@ -199,4 +201,5 @@ The RatPack (short for Rational Pack) is the core of the Calculator model and co
|
|||||||
[CalcManager folder]: ../src/CalcManager
|
[CalcManager folder]: ../src/CalcManager
|
||||||
[CalculatorManager.h]: ../src/CalcManager/CalculatorManager.h
|
[CalculatorManager.h]: ../src/CalcManager/CalculatorManager.h
|
||||||
[CalcEngine.h]: ../src/CalcManager/Header Files/CalcEngine.h
|
[CalcEngine.h]: ../src/CalcManager/Header Files/CalcEngine.h
|
||||||
|
[Infinite Precision]: https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
|
||||||
[ratpak.h]: ../src/CalcManager/Ratpack/ratpak.h
|
[ratpak.h]: ../src/CalcManager/Ratpack/ratpak.h
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 256 KiB |
@ -29,26 +29,26 @@ idea until it is ready for review.
|
|||||||
|
|
||||||
We review pitches regularly, and will approve or close issues based on whether they broadly align with the
|
We review pitches regularly, and will approve or close issues based on whether they broadly align with the
|
||||||
[Calculator roadmap](https://github.com/Microsoft/calculator/blob/master/docs/Roadmap.md). Approved pitches are moved
|
[Calculator roadmap](https://github.com/Microsoft/calculator/blob/master/docs/Roadmap.md). Approved pitches are moved
|
||||||
into [pre-production](https://github.com/Microsoft/calculator/projects/1) on the feature tracking board.
|
into [planning](https://github.com/Microsoft/calculator/projects/1) on the feature tracking board.
|
||||||
|
|
||||||
## Step 2: Pre-production
|
## Step 2: Planning
|
||||||
For most features, the output of this phase is a specification which describes how the feature will work, supported by
|
For most features, the output of this phase is a specification which describes how the feature will work, supported by
|
||||||
design renderings and code prototypes as needed. The original issue will continue to track the overall progress of the
|
design renderings and code prototypes as needed. The original issue will continue to track the overall progress of the
|
||||||
feature, but we will create and iterate on spec documentation in the
|
feature, but we will create and iterate on spec documentation in the
|
||||||
[Calculator Spec repo](https://github.com/Microsoft/calculator-specs). Sometimes we'll learn new things about a feature
|
[Calculator Spec repo](https://github.com/Microsoft/calculator-specs). Sometimes we'll learn new things about a feature
|
||||||
proposal during pre-production, and we'll edit or close the original pitch.
|
proposal during planning, and we'll edit or close the original pitch.
|
||||||
|
|
||||||
We welcome community participation throughout pre-production. The best ideas often come from trying many ideas during
|
We welcome community participation throughout planning. The best ideas often come from trying many ideas during
|
||||||
the pre-production phase. To enable rapid
|
the planning phase. To enable rapid
|
||||||
experimentation, we encourage developing and sharing rough ideas—maybe even with pencil and
|
experimentation, we encourage developing and sharing rough ideas—maybe even with pencil and
|
||||||
paper—before making designs pixel-perfect or making code robust and maintainable.
|
paper—before making designs pixel-perfect or making code robust and maintainable.
|
||||||
|
|
||||||
After the [spec review](https://github.com/Microsoft/calculator-specs#spec-review) is completed, we will move the issue
|
After the [spec review](https://github.com/Microsoft/calculator-specs#spec-review) is completed, we will move the issue
|
||||||
into [production](https://github.com/Microsoft/calculator/projects/1) on the feature tracking board. In _some_ cases,
|
into [implementation](https://github.com/Microsoft/calculator/projects/1) on the feature tracking board. In _some_ cases,
|
||||||
all of the details of an idea can be captured concisely in original feature pitch. When that happens, we may move ideas
|
all of the details of an idea can be captured concisely in original feature pitch. When that happens, we may move ideas
|
||||||
directly into production.
|
directly into implementation.
|
||||||
|
|
||||||
## Step 3: Production
|
## Step 3: Implementation
|
||||||
A feature can be implemented by the original submitter, a Microsoft team member, or by other
|
A feature can be implemented by the original submitter, a Microsoft team member, or by other
|
||||||
community members. Code contributions and testing help are greatly appreciated. Please let everyone know if you're
|
community members. Code contributions and testing help are greatly appreciated. Please let everyone know if you're
|
||||||
actively working on a feature to help avoid duplicated efforts from others.
|
actively working on a feature to help avoid duplicated efforts from others.
|
||||||
|
@ -1,131 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{24767C43-CD5A-4DC9-8D6B-429F255524E5}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Calculator.TestPackage</RootNamespace>
|
|
||||||
<AssemblyName>Calculator.TestPackage</AssemblyName>
|
|
||||||
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
|
|
||||||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
|
||||||
<NuGetTargetMoniker>.NETCore,Version=v5.0</NuGetTargetMoniker>
|
|
||||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
|
||||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
|
|
||||||
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<!-- The app doesn't contain any tests so we don't generate a testmd -->
|
|
||||||
<NoTestMD>true</NoTestMD>
|
|
||||||
<NoPackage Condition="'$(IsTFSBuild)' != 'True'">True</NoPackage>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\x86</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\x86</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\x64</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\x64</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\arm</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>ARM</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\arm</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>ARM</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM64' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\ARM64\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>ARM64</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM64' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\ARM64\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>ARM64</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Calculator.TestPackage.wm.xml" />
|
|
||||||
<None Include="project.json" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\src\Calculator\Calculator.vcxproj">
|
|
||||||
<Project>{9447424a-0e05-4911-beb8-e0354405f39a}</Project>
|
|
||||||
<Name>Calculator</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0' ">
|
|
||||||
<VisualStudioVersion>15.0</VisualStudioVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- Redefine build target as we don't want to build anything. -->
|
|
||||||
<Target Name="Build" />
|
|
||||||
<Target Name="Clean" />
|
|
||||||
<Target Name="Rebuild" />
|
|
||||||
<!-- Append the appx properties to the custom macros as we use this in the testmd.definition file. -->
|
|
||||||
<Target Name="AppendUniversalTestCustomMacros" BeforeTargets="BuildUniversalTest">
|
|
||||||
<ItemGroup>
|
|
||||||
<AppxBundleOutput Include="$(OutDir)..\Calculator\AppPackages\**\*.appxbundle" />
|
|
||||||
<AppxPackagePublicKeyFile Include="$(OutDir)..\Calculator\AppPackages\**\*.cer" />
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<AppxPackageTestDir>@(AppxBundleOutput->'%(RootDir)%(Directory)')</AppxPackageTestDir>
|
|
||||||
<UniversalTestCustomMacros Condition="'$(Configuration)'=='Debug'">$(UniversalTestCustomMacros)AppxPackageVCLibsDependency=$(AppxPackageTestDir)Dependencies\$(PlatformTarget)\Microsoft.VCLibs.$(PlatformTarget).Debug.14.00.appx;</UniversalTestCustomMacros>
|
|
||||||
<UniversalTestCustomMacros Condition="'$(Configuration)'=='Release'">$(UniversalTestCustomMacros)AppxPackageVCLibsDependency=$(AppxPackageTestDir)Dependencies\$(PlatformTarget)\Microsoft.VCLibs.$(PlatformTarget).14.00.appx;</UniversalTestCustomMacros>
|
|
||||||
<UniversalTestCustomMacros>$(UniversalTestCustomMacros)AppxPackageWinUIDependency=$(AppxPackageTestDir)Dependencies\$(PlatformTarget)\Microsoft.UI.Xaml.2.0.appx;</UniversalTestCustomMacros>
|
|
||||||
<UniversalTestCustomMacros>$(UniversalTestCustomMacros)AppxPackagePublicKeyFile=@(AppxPackagePublicKeyFile->'%(FullPath)');AppxBundleOutput=@(AppxBundleOutput->'%(FullPath)');</UniversalTestCustomMacros>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Target>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
|
@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--Copyright (c) Microsoft Corporation. All rights reserved.-->
|
|
||||||
<identity
|
|
||||||
xmlns="urn:Microsoft.CompPlat/ManifestSchema.v1.00"
|
|
||||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
name="App"
|
|
||||||
namespace="Calculator"
|
|
||||||
owner="Microsoft">
|
|
||||||
<files>
|
|
||||||
<file
|
|
||||||
source="$(AppxBundleOutput)"
|
|
||||||
destinationDir="$(runtime.testbin)"
|
|
||||||
name="Calculator.appxbundle" />
|
|
||||||
<file
|
|
||||||
source="$(AppxPackagePublicKeyFile)"
|
|
||||||
destinationDir="$(runtime.testbin)"
|
|
||||||
name="Calculator.cer" />
|
|
||||||
<file
|
|
||||||
source="$(AppxPackageVCLibsDependency)"
|
|
||||||
destinationDir="$(runtime.testbin)"
|
|
||||||
name="Microsoft.VCLibs.appx" />
|
|
||||||
<file
|
|
||||||
source="$(AppxPackageWinUIDependency)"
|
|
||||||
destinationDir="$(runtime.testbin)"
|
|
||||||
name="Microsoft.UI.Xaml.appx" />
|
|
||||||
</files>
|
|
||||||
</identity>
|
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.TestInfrastructure.UniversalTest": "1.0.20181107.1"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"netcore50": {}
|
|
||||||
},
|
|
||||||
"runtimes": {
|
|
||||||
"win10-arm": {},
|
|
||||||
"win10-x64": {},
|
|
||||||
"win10-x86": {}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{A43517B5-8BE3-4312-913F-004978C34444}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Calculator.UIAutomationLibrary</RootNamespace>
|
|
||||||
<AssemblyName>Calculator.UIAutomationLibrary</AssemblyName>
|
|
||||||
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
|
|
||||||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
|
||||||
<NuGetTargetMoniker>.NETCore,Version=v5.0</NuGetTargetMoniker>
|
|
||||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
|
||||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
|
|
||||||
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="CalculatorAppLauncher.cs" />
|
|
||||||
<Compile Include="Components\App\CalculatorAppLfm.cs" />
|
|
||||||
<Compile Include="Components\App\CalculatorAppPom.cs" />
|
|
||||||
<Compile Include="Components\ContentDialogLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\CalculatorBasePom.cs" />
|
|
||||||
<Compile Include="Components\Pages\AboutFlyoutLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\AboutFlyoutPom.cs" />
|
|
||||||
<Compile Include="Components\Pages\DateCalculatorLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\DateCalculatorPom.cs" />
|
|
||||||
<Compile Include="Components\Pages\UnitConverterLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\UnitConverterPom.cs" />
|
|
||||||
<Compile Include="Components\Shared\HistoryLfm.cs" />
|
|
||||||
<Compile Include="Components\Shared\HistoryPom.cs" />
|
|
||||||
<Compile Include="Components\Shared\ICanFocusWithClicks.cs" />
|
|
||||||
<Compile Include="Components\Shared\MemoryLfm.cs" />
|
|
||||||
<Compile Include="Components\Shared\MemoryPom.cs" />
|
|
||||||
<Compile Include="Components\Pages\NavBarLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\NavBarPom.cs" />
|
|
||||||
<Compile Include="Components\Shared\NumberPadPom.cs" />
|
|
||||||
<Compile Include="Components\Pages\ProgrammerCalculatorLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\ProgrammerCalculatorPom.cs" />
|
|
||||||
<Compile Include="Components\Pages\ScientificCalculatorLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\ScientificCalculatorPom.cs" />
|
|
||||||
<Compile Include="Components\Pages\StandardCalculatorLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\StandardCalculatorPom.cs" />
|
|
||||||
<Compile Include="Components\Pages\MainPageLfm.cs" />
|
|
||||||
<Compile Include="Components\Pages\MainPagePom.cs" />
|
|
||||||
<Compile Include="Utilities\Impersonator.cs" />
|
|
||||||
<Compile Include="Utilities\PerfTestConstants.cs" />
|
|
||||||
<Compile Include="Tests\BasicCalculationTest.cs" />
|
|
||||||
<Compile Include="Tests\ScientificCalculationTest.cs" />
|
|
||||||
<Compile Include="Utilities\EtwHelper.cs" />
|
|
||||||
<Compile Include="Utilities\InstallHelper.cs" />
|
|
||||||
<Compile Include="Components\ContentDialogPom.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Utilities\Constants.cs" />
|
|
||||||
<Compile Include="Utilities\NativeMethods.cs" />
|
|
||||||
<Compile Include="Utilities\ServiceHelper.cs" />
|
|
||||||
<Compile Include="Utilities\UIObjectExtensions.cs" />
|
|
||||||
<Compile Include="Utilities\Utilities.cs" />
|
|
||||||
<Compile Include="Utilities\WindowHelper.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="project.json" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup />
|
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0' ">
|
|
||||||
<VisualStudioVersion>15.0</VisualStudioVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
|
||||||
<!--additional imports-->
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
@ -1,63 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Etw.Managed;
|
|
||||||
using Microsoft.OneCoreUap.Test.AppModel;
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using Calculator.UIAutomationLibrary.Components;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class that can open and close the Calculator app.
|
|
||||||
/// </summary>
|
|
||||||
public static class CalculatorAppLauncher
|
|
||||||
{
|
|
||||||
public const string CoreWindowClassName = "Windows.UI.Core.CoreWindow";
|
|
||||||
|
|
||||||
// This doesn't actually work right now because popup will disappear
|
|
||||||
// Bug 13713223: ContentDialog/Popup does not show up in the UIA tree when Windows.Current.Content has an AutomationName set.
|
|
||||||
// public static readonly UICondition TopLevelWindowUICondition = UICondition.CreateFromId(Constants.TopLevelWindowAutomationId);
|
|
||||||
public static readonly UICondition CoreWindowUICondition = UICondition.CreateFromClassName(CoreWindowClassName)
|
|
||||||
.AndWith(UICondition.CreateFromName(Constants.AppWindowName));
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Launch the app
|
|
||||||
/// </summary>
|
|
||||||
public static CalculatorAppLfm Launch()
|
|
||||||
{
|
|
||||||
Log.Comment("Launching Calculator and waiting for first page load...");
|
|
||||||
|
|
||||||
// Need to set this for the MITALite Tap~ methods to work on high DPI screens.
|
|
||||||
UAPApp.SetTestDPIAwareness();
|
|
||||||
|
|
||||||
// We want to be able to see any element in the tree
|
|
||||||
Context.RawContext.Activate();
|
|
||||||
|
|
||||||
// Set default wait timeout.
|
|
||||||
MS.Internal.Mita.Foundation.Waiters.Waiter.DefaultTimeout = TimeSpan.FromSeconds(30);
|
|
||||||
|
|
||||||
// Enable Mita internal logging.
|
|
||||||
MS.Internal.Mita.Foundation.Utilities.Log.OutImplementation = (s, a) => { Log.Comment($"- [MitaLite] { string.Format(s, a) }"); };
|
|
||||||
|
|
||||||
using (EtwWaiter appLaunchWaiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.AppLaunchEndETWEventName))
|
|
||||||
{
|
|
||||||
var viewDescriptor = NavigationHelper.LaunchApplication(Constants.PackageAppUserModelId);
|
|
||||||
appLaunchWaiter.Wait(TimeSpan.FromSeconds(30));
|
|
||||||
|
|
||||||
Window calculatorWindow = new Window(UIObject.Root.Descendants.Find(CoreWindowUICondition));
|
|
||||||
Debug.Assert(calculatorWindow.ClassName == CoreWindowClassName);
|
|
||||||
|
|
||||||
// Move our window to the foreground.
|
|
||||||
WindowHelper.SetAsForeground(calculatorWindow.GetTopLevelWindow());
|
|
||||||
|
|
||||||
return new CalculatorAppLfm(new CalculatorAppPom(calculatorWindow), viewDescriptor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Microsoft.OneCoreUap.Test.AppModel;
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class CalculatorAppLfm
|
|
||||||
{
|
|
||||||
private readonly IViewDescriptor viewDescriptor;
|
|
||||||
|
|
||||||
public CalculatorAppLfm(CalculatorAppPom objectModel, IViewDescriptor viewDescriptor)
|
|
||||||
{
|
|
||||||
this.ObjectModel = objectModel;
|
|
||||||
this.viewDescriptor = viewDescriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CalculatorAppPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public MainPageLfm MainPageLfm
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new MainPageLfm(this.ObjectModel.MainPagePom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
// ObjectModel is essentially the window ui object.
|
|
||||||
if (this.viewDescriptor != null)
|
|
||||||
{
|
|
||||||
NavigationHelper.CloseApplication(this.viewDescriptor.AUMID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class CalculatorAppPom : UIObject
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new instance of the <see cref="CalculatorAppPom"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uiObject">UIObject for the calculator app window.</param>
|
|
||||||
public CalculatorAppPom(UIObject uiObject)
|
|
||||||
: base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
public MainPagePom MainPagePom
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new MainPagePom(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class ContentDialogLfm
|
|
||||||
{
|
|
||||||
public ContentDialogLfm(ContentDialogPom objectModel)
|
|
||||||
{
|
|
||||||
this.ObjectModel = objectModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContentDialogPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void InvokePrimary()
|
|
||||||
{
|
|
||||||
this.ObjectModel.PrimaryButton.Invoke();
|
|
||||||
}
|
|
||||||
public void InvokeSecondary()
|
|
||||||
{
|
|
||||||
this.ObjectModel.SecondaryButton.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InvokeClose()
|
|
||||||
{
|
|
||||||
this.ObjectModel.CloseButton.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class ContentDialogPom : UIObject
|
|
||||||
{
|
|
||||||
private static readonly UICondition textScrollViewerCondition = UICondition.CreateFromId("ContentScrollViewer");
|
|
||||||
private static readonly UICondition titleTextBlockCondition = UICondition.CreateFromClassName("TextBlock");
|
|
||||||
|
|
||||||
private static readonly UICondition primaryButtonCondition =
|
|
||||||
UICondition.CreateFromClassName("Button")
|
|
||||||
.AndWith(UICondition.CreateFromId("PrimaryButton"));
|
|
||||||
private static readonly UICondition secondaryButtonCondition =
|
|
||||||
UICondition.CreateFromClassName("Button")
|
|
||||||
.AndWith(UICondition.CreateFromId("SecondaryButton"));
|
|
||||||
private static readonly UICondition closeButtonCondition =
|
|
||||||
UICondition.CreateFromClassName("Button")
|
|
||||||
.AndWith(UICondition.CreateFromId("CloseButton"));
|
|
||||||
|
|
||||||
public ContentDialogPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button PrimaryButton
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new Button(this.Children.Find(primaryButtonCondition));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button SecondaryButton
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new Button(this.Children.Find(secondaryButtonCondition));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button CloseButton
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new Button(this.Children.Find(closeButtonCondition));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var scrollViewer = this.Children.Find(textScrollViewerCondition);
|
|
||||||
var textBlock = scrollViewer.Children.Find(titleTextBlockCondition);
|
|
||||||
return textBlock.Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class AboutFlyoutLfm : ICanFocusWithClicks
|
|
||||||
{
|
|
||||||
private const string FlyoutId = "FlyoutNav";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="AboutFlyoutLfm" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="objectModel">The AboutFlyoutPom that represents the About flyout panel.</param>
|
|
||||||
public AboutFlyoutLfm(AboutFlyoutPom objectModel)
|
|
||||||
{
|
|
||||||
this.ObjectModel = objectModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AboutFlyoutPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void FocusWithClicks()
|
|
||||||
{
|
|
||||||
this.ObjectModel.Title.DoubleClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
this.ObjectModel.SendKeys("{ESC}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class AboutFlyoutPom : UIObject
|
|
||||||
{
|
|
||||||
private const string TitleId = "Header";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="AboutFlyoutPom" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uiObject">The UIObject that is the root of the navigation menu.</param>
|
|
||||||
public AboutFlyoutPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public UIObject Title
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new UIObject(this.Descendants.Find(TitleId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the Display section of the calculator modes.
|
|
||||||
/// </summary>
|
|
||||||
public class CalculatorBasePom : UIObject
|
|
||||||
{
|
|
||||||
private const string ExpressionContainerId = "CalculatorExpression";
|
|
||||||
private const string NormalOutputId = "normalOutput";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="StandardCalculatorPom" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uiObject">The UIObject that is the root of the standard calculator.</param>
|
|
||||||
public CalculatorBasePom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public TextBlock Expression
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new TextBlock(this.Descendants.Find(ExpressionContainerId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UIEventWaiter GetExpressionChangedWaiter()
|
|
||||||
{
|
|
||||||
return new PropertyChangedEventWaiter(this.Expression, UIProperty.Get("Name"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public TextBlock Display
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new TextBlock(this.Descendants.Find(NormalOutputId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UIEventWaiter GetDisplayChangedWaiter()
|
|
||||||
{
|
|
||||||
return new PropertyChangedEventWaiter(this.Display, UIProperty.Get("Name"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class DateCalculatorLfm
|
|
||||||
{
|
|
||||||
public DateCalculatorLfm(DateCalculatorPom dateCalculatorPom)
|
|
||||||
{
|
|
||||||
this.ObjectModel = dateCalculatorPom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateCalculatorPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void EnsureDateDifferenceMode()
|
|
||||||
{
|
|
||||||
this.OpenModeSelector();
|
|
||||||
this.ObjectModel.ModeSelector.AllItems[0].Select();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnsureAddSubtractMode()
|
|
||||||
{
|
|
||||||
this.OpenModeSelector();
|
|
||||||
this.ObjectModel.ModeSelector.AllItems[1].Select();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenModeSelector()
|
|
||||||
{
|
|
||||||
using (var waiter = this.ObjectModel.ModeSelector.GetExpandedWaiter())
|
|
||||||
{
|
|
||||||
this.ObjectModel.ModeSelector.Expand();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class DateCalculatorPom : UIObject
|
|
||||||
{
|
|
||||||
private const string ModeSelectorId = "DateCalculationOption";
|
|
||||||
|
|
||||||
public DateCalculatorPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComboBox ModeSelector
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new ComboBox(this.Descendants.Find(ModeSelectorId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,255 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Etw.Managed;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class MainPageLfm : ICanFocusWithClicks
|
|
||||||
{
|
|
||||||
public MainPageLfm(MainPagePom objectModel)
|
|
||||||
{
|
|
||||||
this.ObjectModel = objectModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MainPagePom ObjectModel { get; }
|
|
||||||
|
|
||||||
public NavBarLfm OpenNavBar()
|
|
||||||
{
|
|
||||||
using (EtwWaiter waiter = this.ObjectModel.GetNavBarOpenedWaiter())
|
|
||||||
{
|
|
||||||
this.ObjectModel.NavButton.Invoke();
|
|
||||||
waiter.Wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new NavBarLfm(this.ObjectModel.NavBarPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CloseNavBar()
|
|
||||||
{
|
|
||||||
this.ObjectModel.NavBarPom.CloseButton.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void FocusWithClicks()
|
|
||||||
{
|
|
||||||
this.ObjectModel.Header.DoubleClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
public StandardCalculatorLfm NavigateToStandardCalculator()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectStandard();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new StandardCalculatorLfm(this.ObjectModel.StandardCalculatorPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ScientificCalculatorLfm NavigateToScientificCalculator()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectScientific();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ScientificCalculatorLfm(this.ObjectModel.ScientificCalculatorPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProgrammerCalculatorLfm NavigateToProgrammerCalculator()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectProgrammer();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ProgrammerCalculatorLfm(this.ObjectModel.ProgrammerCalculatorPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateCalculatorLfm NavigateToDateCalculator()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectDate();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new DateCalculatorLfm(this.ObjectModel.DateCalculatorPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToCurrencyConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectCurrency();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToVolumeConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectVolume();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToLengthConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectLength();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToWeightConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectWeight();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToTemperatureConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectTemperature();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToEnergyConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectEnergy();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToAreaConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectArea();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToSpeedConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectSpeed();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToTimeConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectTime();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToPowerConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectPower();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToDataConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectData();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToPressureConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectPressure();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterLfm NavigateToAngleConverter()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (var waiter = this.ObjectModel.GetModeChangedWaiter())
|
|
||||||
{
|
|
||||||
navBar.SelectAngle();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UnitConverterLfm(this.ObjectModel.UnitConverterPom);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AboutFlyoutLfm OpenAboutFlyout()
|
|
||||||
{
|
|
||||||
var navBar = this.OpenNavBar();
|
|
||||||
using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.AboutFlyoutOpenedETWEventName))
|
|
||||||
{
|
|
||||||
navBar.SelectAbout();
|
|
||||||
waiter.Wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new AboutFlyoutLfm(this.ObjectModel.AboutFlyoutPom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Etw.Managed;
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Physical Object Model for the app window.
|
|
||||||
/// POM is the implementation model of the app.
|
|
||||||
/// See https://en.wikipedia.org/wiki/Model-based_testing for model-based testing.
|
|
||||||
/// </summary>
|
|
||||||
public class MainPagePom : UIObject
|
|
||||||
{
|
|
||||||
private const string NavButtonId = "TogglePaneButton";
|
|
||||||
private const string SplitViewPaneRootId = "PaneRoot";
|
|
||||||
private const string NavBarFlyoutId = "FlyoutNav";
|
|
||||||
private const string HeaderId = "Header";
|
|
||||||
private const string AboutPageFlyoutId = "AboutPageFlyout";
|
|
||||||
|
|
||||||
public MainPagePom(UIObject uiObject)
|
|
||||||
: base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button NavButton => new Button(this.Descendants.Find(UICondition.CreateFromId(NavButtonId)));
|
|
||||||
|
|
||||||
public UIObject Header => new UIObject(this.Descendants.Find(HeaderId));
|
|
||||||
|
|
||||||
public NavBarPom NavBarPom => new NavBarPom(this.Children.Find(SplitViewPaneRootId));
|
|
||||||
|
|
||||||
public EtwWaiter GetNavBarOpenedWaiter() => new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.NavBarOpenedETWEventName);
|
|
||||||
|
|
||||||
public StandardCalculatorPom StandardCalculatorPom => new StandardCalculatorPom(this);
|
|
||||||
|
|
||||||
public ScientificCalculatorPom ScientificCalculatorPom => new ScientificCalculatorPom(this);
|
|
||||||
|
|
||||||
public ProgrammerCalculatorPom ProgrammerCalculatorPom => new ProgrammerCalculatorPom(this);
|
|
||||||
|
|
||||||
public DateCalculatorPom DateCalculatorPom => new DateCalculatorPom(this);
|
|
||||||
|
|
||||||
public UnitConverterPom UnitConverterPom => new UnitConverterPom(this);
|
|
||||||
|
|
||||||
public AboutFlyoutPom AboutFlyoutPom => new AboutFlyoutPom(this.Descendants.Find(AboutPageFlyoutId));
|
|
||||||
|
|
||||||
public EtwWaiter GetModeChangedWaiter() => new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.AppModeChangeEndETWEventName);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,144 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Windows.Automation;
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using MS.Internal.Mita.Foundation.Patterns;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the NavBar of the Calculator app.
|
|
||||||
/// </summary>
|
|
||||||
public class NavBarLfm : ICanFocusWithClicks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="NavBarLfm" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="objectModel">The NavBarPom that represents the NavBar.</param>
|
|
||||||
public NavBarLfm(NavBarPom objectModel)
|
|
||||||
{
|
|
||||||
this.ObjectModel = objectModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NavBarPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void SelectStandard()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.StandardMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectScientific()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.ScientificMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectProgrammer()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.ProgrammerMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectDate()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.DateMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectCurrency()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.CurrencyMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectVolume()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.VolumeMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectLength()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.LengthMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectWeight()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.WeightMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectTemperature()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.TemperatureMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectEnergy()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.EnergyMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectArea()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.AreaMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectSpeed()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.SpeedMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectTime()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.TimeMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectPower()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.PowerMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectData()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.DataMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectPressure()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.PressureMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectAngle()
|
|
||||||
{
|
|
||||||
SelectItem(this.ObjectModel.AngleMenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SelectAbout()
|
|
||||||
{
|
|
||||||
this.ObjectModel.AboutButton.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
this.ObjectModel.CloseButton.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void FocusWithClicks()
|
|
||||||
{
|
|
||||||
// To focus (for AccSpot) without changing anything, click to the right of the close button.
|
|
||||||
Button button = this.ObjectModel.CloseButton;
|
|
||||||
int xPos = button.BoundingRectangle.Width + Constants.ClickMargin;
|
|
||||||
int yPos = button.BoundingRectangle.Height / 2;
|
|
||||||
button.DoubleClick(PointerButtons.Primary, xPos, yPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SelectItem(ListViewItem item)
|
|
||||||
{
|
|
||||||
if (item.IsSelected)
|
|
||||||
{
|
|
||||||
this.Close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item.Select();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the navigation menu.
|
|
||||||
/// </summary>
|
|
||||||
public class NavBarPom : UIObject
|
|
||||||
{
|
|
||||||
private const string StandardId = "Standard";
|
|
||||||
private const string ScientificId = "Scientific";
|
|
||||||
private const string ProgrammerId = "Programmer";
|
|
||||||
private const string DateId = "Date";
|
|
||||||
private const string CurrencyId = "Currency";
|
|
||||||
private const string VolumeId = "Volume";
|
|
||||||
private const string LengthId = "Length";
|
|
||||||
private const string WeightId = "Weight";
|
|
||||||
private const string TemperatureId = "Temperature";
|
|
||||||
private const string EnergyId = "Energy";
|
|
||||||
private const string AreaId = "Area";
|
|
||||||
private const string SpeedId = "Speed";
|
|
||||||
private const string TimeId = "Time";
|
|
||||||
private const string PowerId = "Power";
|
|
||||||
private const string DataId = "Data";
|
|
||||||
private const string PressureId = "Pressure";
|
|
||||||
private const string AngleId = "Angle";
|
|
||||||
private const string AboutId = "AboutButton";
|
|
||||||
private const string CloseId = "TogglePaneButton";
|
|
||||||
private const string FlyoutListViewId = "MenuItemsHost";
|
|
||||||
private const string ConverterSectionId = "Converter";
|
|
||||||
private const string ConverterTextKey = "ConverterModeText";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="NavBarPom" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uiObject">The UIObject that is the root of the navigation menu.</param>
|
|
||||||
public NavBarPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ListViewItem StandardMenuItem => ScrollAndGetItem(StandardId);
|
|
||||||
|
|
||||||
public ListViewItem ScientificMenuItem => ScrollAndGetItem(ScientificId);
|
|
||||||
|
|
||||||
public ListViewItem ProgrammerMenuItem => ScrollAndGetItem(ProgrammerId);
|
|
||||||
|
|
||||||
public ListViewItem DateMenuItem => ScrollAndGetItem(DateId);
|
|
||||||
|
|
||||||
public ListViewItem CurrencyMenuItem => ScrollAndGetItem(CurrencyId);
|
|
||||||
|
|
||||||
public ListViewItem VolumeMenuItem => ScrollAndGetItem(VolumeId);
|
|
||||||
|
|
||||||
public ListViewItem LengthMenuItem => ScrollAndGetItem(LengthId);
|
|
||||||
|
|
||||||
public ListViewItem WeightMenuItem => ScrollAndGetItem(WeightId);
|
|
||||||
|
|
||||||
public ListViewItem TemperatureMenuItem => ScrollAndGetItem(TemperatureId);
|
|
||||||
|
|
||||||
public ListViewItem EnergyMenuItem => ScrollAndGetItem(EnergyId);
|
|
||||||
|
|
||||||
public ListViewItem AreaMenuItem => ScrollAndGetItem(AreaId);
|
|
||||||
|
|
||||||
public ListViewItem SpeedMenuItem => ScrollAndGetItem(SpeedId);
|
|
||||||
|
|
||||||
public ListViewItem TimeMenuItem => ScrollAndGetItem(TimeId);
|
|
||||||
|
|
||||||
public ListViewItem PowerMenuItem => ScrollAndGetItem(PowerId);
|
|
||||||
|
|
||||||
public ListViewItem DataMenuItem => ScrollAndGetItem(DataId);
|
|
||||||
|
|
||||||
public ListViewItem PressureMenuItem => ScrollAndGetItem(PressureId);
|
|
||||||
|
|
||||||
public ListViewItem AngleMenuItem => ScrollAndGetItem(AngleId);
|
|
||||||
|
|
||||||
public Button AboutButton => new Button(this.Descendants.Find(AboutId));
|
|
||||||
|
|
||||||
public Button CloseButton => new Button(this.Parent.Children.Find(CloseId));
|
|
||||||
|
|
||||||
public ListView ModeListView => new ListView(this.Descendants.Find(FlyoutListViewId));
|
|
||||||
|
|
||||||
private ListViewItem ScrollAndGetItem(string id)
|
|
||||||
{
|
|
||||||
ListViewItem item;
|
|
||||||
var res = this.ModeListView.AllItems.TryFind(id, out item);
|
|
||||||
|
|
||||||
item.ScrollIntoView();
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class ProgrammerCalculatorLfm
|
|
||||||
{
|
|
||||||
public ProgrammerCalculatorLfm(ProgrammerCalculatorPom programmerCalculatorPom)
|
|
||||||
{
|
|
||||||
this.ObjectModel = programmerCalculatorPom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProgrammerCalculatorPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void EnsureFullKeypad()
|
|
||||||
{
|
|
||||||
if (!this.ObjectModel.FullKeypadButton.IsSelected)
|
|
||||||
{
|
|
||||||
this.ObjectModel.FullKeypadButton.Select();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnsureBitTogglingKeypad()
|
|
||||||
{
|
|
||||||
if (!this.ObjectModel.BitFlipKeypadButton.IsSelected)
|
|
||||||
{
|
|
||||||
this.ObjectModel.BitFlipKeypadButton.Select();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeBitLength()
|
|
||||||
{
|
|
||||||
this.ObjectModel.GetCurrentBitLengthButton().Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MemoryLfm OpenMemory()
|
|
||||||
{
|
|
||||||
MemoryLfm lfm = new MemoryLfm(this.ObjectModel.MemoryControls);
|
|
||||||
lfm.OpenBody();
|
|
||||||
return lfm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void FiveMemorySet()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
this.ObjectModel.NumberPad.FiveButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ObjectModel.MemoryControls.SetButton.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class ProgrammerCalculatorPom : UIObject
|
|
||||||
{
|
|
||||||
private const string FullKeypadButtonId = "fullKeypad";
|
|
||||||
private const string BitFlipKeypadButtonId = "bitFlip";
|
|
||||||
private const string CalculatorResultsId = "CalculatorResults";
|
|
||||||
private const string NumberPadId = "NumberPad";
|
|
||||||
|
|
||||||
private readonly string[] BitLengthButtonIds =
|
|
||||||
{
|
|
||||||
"qwordButton",
|
|
||||||
"dwordButton",
|
|
||||||
"wordButton",
|
|
||||||
"byteButton"
|
|
||||||
};
|
|
||||||
|
|
||||||
public ProgrammerCalculatorPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public NumberPadPom NumberPad => new NumberPadPom(this.Descendants.Find(NumberPadId));
|
|
||||||
|
|
||||||
public MemoryPom MemoryControls => new MemoryPom(this);
|
|
||||||
|
|
||||||
public RadioButton FullKeypadButton => new RadioButton(this.Descendants.Find(FullKeypadButtonId));
|
|
||||||
|
|
||||||
public RadioButton BitFlipKeypadButton => new RadioButton(this.Descendants.Find(BitFlipKeypadButtonId));
|
|
||||||
|
|
||||||
public TextBlock Display => new TextBlock(this.Descendants.Find(CalculatorResultsId));
|
|
||||||
|
|
||||||
public UIEventWaiter GetDisplayChangedWaiter() => this.Display.GetNameChangedWaiter();
|
|
||||||
|
|
||||||
public Button GetCurrentBitLengthButton()
|
|
||||||
{
|
|
||||||
// There are four bit length buttons, with only one visible at a time.
|
|
||||||
UIObject button = null;
|
|
||||||
foreach (var buttonId in this.BitLengthButtonIds)
|
|
||||||
{
|
|
||||||
if (this.Descendants.TryFind(buttonId, out button))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Button(button);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,138 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the Standard calculator view.
|
|
||||||
/// </summary>
|
|
||||||
public class ScientificCalculatorLfm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ScientificCalculatorLfm" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uiObject">The UIObject that is the root of the scientific Calculator.</param>
|
|
||||||
public ScientificCalculatorLfm(ScientificCalculatorPom objectModel)
|
|
||||||
{
|
|
||||||
this.ObjectModel = objectModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ScientificCalculatorPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void Press1()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking 1");
|
|
||||||
this.ObjectModel.OneButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Press2()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking 2");
|
|
||||||
this.ObjectModel.NumberPad.TwoButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Press3()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking 3");
|
|
||||||
this.ObjectModel.ThreeButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Press4()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking 4");
|
|
||||||
this.ObjectModel.FourButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PressSqrt()
|
|
||||||
{
|
|
||||||
// When invoking sqrt, both the expression changes.
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking sqrt");
|
|
||||||
this.ObjectModel.SqrtButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PressMinus()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking minus");
|
|
||||||
this.ObjectModel.MinusButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PressPlus()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking plus");
|
|
||||||
this.ObjectModel.PlusButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PressEquals()
|
|
||||||
{
|
|
||||||
// When invoking equals, both the display and the expression change.
|
|
||||||
using (UIEventWaiter expressionWaiter = this.ObjectModel.GetExpressionChangedWaiter())
|
|
||||||
using (UIEventWaiter displayWaiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking equals");
|
|
||||||
this.ObjectModel.EqualButton.Invoke();
|
|
||||||
expressionWaiter.TryWait();
|
|
||||||
displayWaiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnePlusTwoEnter()
|
|
||||||
{
|
|
||||||
Press1();
|
|
||||||
PressPlus();
|
|
||||||
Press2();
|
|
||||||
PressEquals();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MemorySet() => this.ObjectModel.MemoryControls.SetButton.Invoke();
|
|
||||||
|
|
||||||
public MemoryLfm OpenMemory()
|
|
||||||
{
|
|
||||||
MemoryLfm lfm = new MemoryLfm(this.ObjectModel.MemoryControls);
|
|
||||||
lfm.OpenBody();
|
|
||||||
return lfm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HistoryLfm OpenHistory()
|
|
||||||
{
|
|
||||||
HistoryLfm lfm = new HistoryLfm(this.ObjectModel.HistoryControls);
|
|
||||||
lfm.OpenBody();
|
|
||||||
return lfm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the Scientific Calculator
|
|
||||||
/// </summary>
|
|
||||||
public class ScientificCalculatorPom : CalculatorBasePom
|
|
||||||
{
|
|
||||||
private const string NumberPadId = "NumberPad";
|
|
||||||
private const string StandardOperatorsId = "StandardOperators";
|
|
||||||
private const string DisplayControlsId = "DisplayControls";
|
|
||||||
private const string ScientificFunctionsId = "ScientificFunctions";
|
|
||||||
private const string OneButtonId = "num1Button";
|
|
||||||
private const string ThreeButtonId = "num3Button";
|
|
||||||
private const string FourButtonId = "num4Button";
|
|
||||||
private const string SqrtButtonId = "squareRootButton";
|
|
||||||
private const string MinusButtonId = "minusButton";
|
|
||||||
private const string PlusButtonId = "plusButton";
|
|
||||||
private const string EqualButtonId = "equalButton";
|
|
||||||
private const string ClearButtonId = "clearButton";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ScientificCalculatorPom" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uiObject">The UIObject that is the root of the scientific calculator.</param>
|
|
||||||
public ScientificCalculatorPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public UIObject StandardOperatorsGroup => this.Descendants.Find(StandardOperatorsId);
|
|
||||||
|
|
||||||
public UIObject DisplayControlsGroup => this.Descendants.Find(DisplayControlsId);
|
|
||||||
|
|
||||||
public UIObject ScientificFunctionsGroup => this.Descendants.Find(ScientificFunctionsId);
|
|
||||||
|
|
||||||
public Button OneButton => this.NumberPad.OneButton;
|
|
||||||
|
|
||||||
public Button ThreeButton => this.NumberPad.ThreeButton;
|
|
||||||
|
|
||||||
public Button FourButton => this.NumberPad.FourButton;
|
|
||||||
|
|
||||||
public Button SqrtButton => new Button(this.ScientificFunctionsGroup.Children.Find(SqrtButtonId));
|
|
||||||
|
|
||||||
public Button MinusButton => new Button(this.StandardOperatorsGroup.Children.Find(MinusButtonId));
|
|
||||||
|
|
||||||
public Button PlusButton => new Button(this.StandardOperatorsGroup.Children.Find(PlusButtonId));
|
|
||||||
|
|
||||||
public Button EqualButton => new Button(this.StandardOperatorsGroup.Children.Find(EqualButtonId));
|
|
||||||
|
|
||||||
public Button ClearButton => new Button(this.DisplayControlsGroup.Children.Find(ClearButtonId));
|
|
||||||
|
|
||||||
public NumberPadPom NumberPad => new NumberPadPom(this.Descendants.Find(NumberPadId));
|
|
||||||
|
|
||||||
public HistoryPom HistoryControls => new HistoryPom(this);
|
|
||||||
|
|
||||||
public MemoryPom MemoryControls => new MemoryPom(this);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the Standard calculator view.
|
|
||||||
/// </summary>
|
|
||||||
public class StandardCalculatorLfm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="StandardCalculatorLfm" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uiObject">The UIObject that is the root of the Standard Calculator.</param>
|
|
||||||
public StandardCalculatorLfm(StandardCalculatorPom objectModel)
|
|
||||||
{
|
|
||||||
this.ObjectModel = objectModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StandardCalculatorPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void OnePlusTwoEnter()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking 1");
|
|
||||||
this.ObjectModel.NumPad.OneButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Pressing +");
|
|
||||||
this.ObjectModel.SendKeys("{ADD}");
|
|
||||||
// PropertyChangeWaiter is unreliable for the first name changed notification
|
|
||||||
// Bug 17624996: PropertyChanged event not fired when Name is updated for the first time for a control with custom automation peer.
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Pressing 2");
|
|
||||||
this.ObjectModel.SendKeys("2");
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
// When pressing enter, both the display and the expression change.
|
|
||||||
using (UIEventWaiter expressionWaiter = this.ObjectModel.GetExpressionChangedWaiter())
|
|
||||||
using (UIEventWaiter displayWaiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Invoking equals");
|
|
||||||
this.ObjectModel.EqualButton.Invoke();
|
|
||||||
expressionWaiter.TryWait();
|
|
||||||
displayWaiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Clear()
|
|
||||||
{
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
Log.Comment("Pressing escape");
|
|
||||||
this.ObjectModel.ClearButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearFiveMemorySet()
|
|
||||||
{
|
|
||||||
this.Clear();
|
|
||||||
using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
this.ObjectModel.NumPad.FiveButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ObjectModel.MemoryControls.SetButton.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MemoryLfm OpenMemory()
|
|
||||||
{
|
|
||||||
MemoryLfm lfm = new MemoryLfm(this.ObjectModel.MemoryControls);
|
|
||||||
lfm.OpenBody();
|
|
||||||
return lfm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HistoryLfm OpenHistory()
|
|
||||||
{
|
|
||||||
HistoryLfm lfm = new HistoryLfm(this.ObjectModel.HistoryControls);
|
|
||||||
lfm.OpenBody();
|
|
||||||
return lfm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the Standard Calculator
|
|
||||||
/// </summary>
|
|
||||||
public class StandardCalculatorPom : CalculatorBasePom
|
|
||||||
{
|
|
||||||
private const string CalculatorResultsId = "CalculatorResults";
|
|
||||||
private const string ExpressionContainerId = "CalculatorExpression";
|
|
||||||
private const string NumberPadId = "NumberPad";
|
|
||||||
private const string StandardOperatorsId = "StandardOperators";
|
|
||||||
private const string DisplayControlsId = "DisplayControls";
|
|
||||||
private const string EqualButtonId = "equalButton";
|
|
||||||
private const string ClearButtonId = "clearButton";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="StandardCalculatorPom" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uiObject">The UIObject that is the root of the standard calculator.</param>
|
|
||||||
public StandardCalculatorPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public NumberPadPom NumPad => new NumberPadPom(this.Descendants.Find(NumberPadId));
|
|
||||||
|
|
||||||
public MemoryPom MemoryControls => new MemoryPom(this);
|
|
||||||
|
|
||||||
public HistoryPom HistoryControls => new HistoryPom(this);
|
|
||||||
|
|
||||||
public UIObject StandardOperatorsGroup => this.Descendants.Find(StandardOperatorsId);
|
|
||||||
|
|
||||||
public UIObject DisplayControlsGroup => this.Descendants.Find(DisplayControlsId);
|
|
||||||
|
|
||||||
public Button EqualButton => new Button(this.StandardOperatorsGroup.Children.Find(EqualButtonId));
|
|
||||||
|
|
||||||
public Button ClearButton => new Button(this.DisplayControlsGroup.Children.Find(ClearButtonId));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class UnitConverterLfm
|
|
||||||
{
|
|
||||||
public UnitConverterLfm(UnitConverterPom unitConverterPom)
|
|
||||||
{
|
|
||||||
this.ObjectModel = unitConverterPom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitConverterPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void Eight()
|
|
||||||
{
|
|
||||||
using (var waiter = this.ObjectModel.GetDisplayChangedWaiter())
|
|
||||||
{
|
|
||||||
this.ObjectModel.NumberPad.EightButton.Invoke();
|
|
||||||
waiter.TryWait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class UnitConverterPom : UIObject
|
|
||||||
{
|
|
||||||
private const string DisplayId = "Value1";
|
|
||||||
private const string NumberPadId = "numberPad";
|
|
||||||
|
|
||||||
public UnitConverterPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public NumberPadPom NumberPad => new NumberPadPom(this.Descendants.Find(NumberPadId));
|
|
||||||
|
|
||||||
public TextBlock Display => new TextBlock(this.Descendants.Find(DisplayId));
|
|
||||||
|
|
||||||
public PropertyChangedEventWaiter GetDisplayChangedWaiter() => this.Display.GetNameChangedWaiter();
|
|
||||||
|
|
||||||
public ElementAddedWaiter GetDisplayElementAddedWaiter() => new ElementAddedWaiter(this, Scope.Descendants, DisplayId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Etw.Managed;
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class HistoryLfm : ICanFocusWithClicks
|
|
||||||
{
|
|
||||||
public HistoryLfm(HistoryPom historyPom)
|
|
||||||
{
|
|
||||||
this.ObjectModel = historyPom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HistoryPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void FocusWithClicks()
|
|
||||||
{
|
|
||||||
// On the Programming calc, the default click location can land on the first memory item, dismissing the flyout.
|
|
||||||
// Instead, click just below, in the gutter to the left of the trash can.
|
|
||||||
var body = this.ObjectModel.Body;
|
|
||||||
int height = body.BoundingRectangle.Height;
|
|
||||||
body.DoubleClick(PointerButtons.Primary, Constants.ClickMargin, height + Constants.ClickMargin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OpenBody()
|
|
||||||
{
|
|
||||||
using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.HistoryBodyOpenedETWEventName))
|
|
||||||
{
|
|
||||||
// Only one exists at a given time.
|
|
||||||
if (this.ObjectModel.IsHistoryButtonVisible)
|
|
||||||
{
|
|
||||||
if (!this.ObjectModel.IsBodyOpen)
|
|
||||||
{
|
|
||||||
this.ObjectModel.HistoryButton.Invoke();
|
|
||||||
waiter.Wait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!this.ObjectModel.HistoryPivot.IsSelected)
|
|
||||||
{
|
|
||||||
this.ObjectModel.HistoryPivot.Click();
|
|
||||||
waiter.Wait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class HistoryPom : UIObject
|
|
||||||
{
|
|
||||||
private const string HistoryButtonId = "HistoryButton";
|
|
||||||
private const string HistoryPivotId = "HistoryLabel";
|
|
||||||
private const string BodyId = "HistoryListView";
|
|
||||||
|
|
||||||
public HistoryPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button HistoryButton => new Button(this.Descendants.Find(HistoryButtonId));
|
|
||||||
|
|
||||||
public bool IsHistoryButtonVisible => this.DoesDescendantExist(HistoryButtonId);
|
|
||||||
|
|
||||||
public TabItem HistoryPivot => new TabItem(this.Descendants.Find(HistoryPivotId));
|
|
||||||
|
|
||||||
public UIObject Body => this.Descendants.Find(BodyId);
|
|
||||||
|
|
||||||
public bool IsBodyOpen => this.DoesDescendantExist(BodyId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public interface ICanFocusWithClicks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Sets focus on an object by clicking on it, without causing further action.
|
|
||||||
/// Supports AccSpot scans by raising click events.
|
|
||||||
/// </summary>
|
|
||||||
void FocusWithClicks();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using Etw.Managed;
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class MemoryLfm : ICanFocusWithClicks
|
|
||||||
{
|
|
||||||
public MemoryLfm(MemoryPom memoryPom)
|
|
||||||
{
|
|
||||||
this.ObjectModel = memoryPom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MemoryPom ObjectModel { get; }
|
|
||||||
|
|
||||||
public void FocusWithClicks()
|
|
||||||
{
|
|
||||||
// On the Programming calc, the default click location can land on the first memory item, dismissing the flyout.
|
|
||||||
// Instead, click just below, in the gutter to the left of the trash can.
|
|
||||||
var body = this.ObjectModel.Body;
|
|
||||||
int height = body.BoundingRectangle.Height;
|
|
||||||
body.DoubleClick(PointerButtons.Primary, Constants.ClickMargin, height + Constants.ClickMargin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OpenBody()
|
|
||||||
{
|
|
||||||
using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.MemoryBodyOpenedETWEventName))
|
|
||||||
{
|
|
||||||
// Only one exists at a given time
|
|
||||||
if (this.ObjectModel.IsMemoryButtonVisible)
|
|
||||||
{
|
|
||||||
if (!this.ObjectModel.IsBodyOpen)
|
|
||||||
{
|
|
||||||
this.ObjectModel.MemoryButton.Invoke();
|
|
||||||
waiter.Wait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!this.ObjectModel.MemoryPivot.IsSelected)
|
|
||||||
{
|
|
||||||
this.ObjectModel.MemoryPivot.Click();
|
|
||||||
waiter.Wait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class MemoryPom : UIObject
|
|
||||||
{
|
|
||||||
private const string ClearMemoryButtonId = "ClearMemoryButton";
|
|
||||||
private const string RecallButtonId = "MemRecall";
|
|
||||||
private const string PlusButtonId = "MemPlus";
|
|
||||||
private const string MinusButtonId = "MemMinus";
|
|
||||||
private const string SetButtonId = "memButton";
|
|
||||||
private const string MemoryButtonId = "MemoryButton";
|
|
||||||
private const string MemoryPivotId = "MemoryLabel";
|
|
||||||
private const string BodyId = "MemoryListView";
|
|
||||||
|
|
||||||
public MemoryPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button ClearButton => new Button(this.Descendants.Find(ClearMemoryButtonId));
|
|
||||||
|
|
||||||
public Button RecallButton => new Button(this.Descendants.Find(RecallButtonId));
|
|
||||||
|
|
||||||
public Button PlusButton => new Button(this.Descendants.Find(PlusButtonId));
|
|
||||||
|
|
||||||
public Button MinusButton => new Button(this.Descendants.Find(MinusButtonId));
|
|
||||||
|
|
||||||
public Button SetButton => new Button(this.Descendants.Find(SetButtonId));
|
|
||||||
|
|
||||||
public Button MemoryButton => new Button(this.Descendants.Find(MemoryButtonId));
|
|
||||||
|
|
||||||
public bool IsMemoryButtonVisible => this.DoesDescendantExist(MemoryButtonId);
|
|
||||||
|
|
||||||
public TabItem MemoryPivot => new TabItem(this.Descendants.Find(MemoryPivotId));
|
|
||||||
|
|
||||||
public UIObject Body => this.Descendants.Find(BodyId);
|
|
||||||
|
|
||||||
public bool IsBodyOpen => this.DoesDescendantExist(BodyId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Components
|
|
||||||
{
|
|
||||||
public class NumberPadPom : UIObject
|
|
||||||
{
|
|
||||||
private const string OneButtonId = "num1Button";
|
|
||||||
private const string TwoButtonId = "num2Button";
|
|
||||||
private const string ThreeButtonId = "num3Button";
|
|
||||||
private const string FourButtonId = "num4Button";
|
|
||||||
private const string FiveButtonId = "num5Button";
|
|
||||||
private const string SixButtonId = "num6Button";
|
|
||||||
private const string SevenButtonId = "num7Button";
|
|
||||||
private const string EightButtonId = "num8Button";
|
|
||||||
private const string NineButtonId = "num9Button";
|
|
||||||
private const string ZeroButtonId = "num0Button";
|
|
||||||
private const string DecimalButtonId = "decimalSeparatorButton";
|
|
||||||
|
|
||||||
public NumberPadPom(UIObject uiObject) : base(uiObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button ZeroButton => new Button(this.Children.Find(ZeroButtonId));
|
|
||||||
|
|
||||||
public Button OneButton => new Button(this.Children.Find(OneButtonId));
|
|
||||||
|
|
||||||
public Button TwoButton => new Button(this.Children.Find(TwoButtonId));
|
|
||||||
|
|
||||||
public Button ThreeButton => new Button(this.Children.Find(ThreeButtonId));
|
|
||||||
|
|
||||||
public Button FourButton => new Button(this.Children.Find(FourButtonId));
|
|
||||||
|
|
||||||
public Button FiveButton => new Button(this.Children.Find(FiveButtonId));
|
|
||||||
|
|
||||||
public Button SixButton => new Button(this.Children.Find(SixButtonId));
|
|
||||||
|
|
||||||
public Button SevenButton => new Button(this.Children.Find(SevenButtonId));
|
|
||||||
|
|
||||||
public Button EightButton => new Button(this.Children.Find(EightButtonId));
|
|
||||||
|
|
||||||
public Button NineButton => new Button(this.Children.Find(NineButtonId));
|
|
||||||
|
|
||||||
public Button DecimalButton => new Button(this.Children.Find(DecimalButtonId));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Calculator.UIAutomationLibrary")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("D6913DAD-1C3B-4229-915F-8301A57970FC")]
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Etw.Managed;
|
|
||||||
using Calculator.UIAutomationLibrary.Components;
|
|
||||||
using WEX.TestExecution;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Tests
|
|
||||||
{
|
|
||||||
public static class BasicCalculationTest
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This test uses LFMs to add and then delete an alarm.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="calculatorAppLfm">The LFM for the alarms app window.</param>
|
|
||||||
public static void CalculateOnePlusTwo(this CalculatorAppLfm calculatorAppLfm)
|
|
||||||
{
|
|
||||||
var mainPage = calculatorAppLfm.MainPageLfm;
|
|
||||||
|
|
||||||
var standardCalculator = mainPage.NavigateToStandardCalculator();
|
|
||||||
|
|
||||||
standardCalculator.OnePlusTwoEnter();
|
|
||||||
|
|
||||||
Verify.AreEqual("\u202D3\u202C", standardCalculator.ObjectModel.Display.Name, "Ensure display value is 3");
|
|
||||||
|
|
||||||
standardCalculator.Clear();
|
|
||||||
|
|
||||||
Verify.AreEqual("\u202D0\u202C", standardCalculator.ObjectModel.Display.Name, "Ensure display value is 0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Calculator.UIAutomationLibrary.Components;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WEX.TestExecution;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary.Tests
|
|
||||||
{
|
|
||||||
public static class ScientificCalculationTest
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This test uses LFMs to calculate the sqrt(4) - 2.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="calculatorAppLfm">The LFM for the calculator app window.</param>
|
|
||||||
public static void CalculateSqrt4Minus2(this CalculatorAppLfm calculatorAppLfm)
|
|
||||||
{
|
|
||||||
var mainPage = calculatorAppLfm.MainPageLfm;
|
|
||||||
|
|
||||||
var scientificCalculator = mainPage.NavigateToScientificCalculator();
|
|
||||||
|
|
||||||
scientificCalculator.Press4();
|
|
||||||
scientificCalculator.PressSqrt();
|
|
||||||
scientificCalculator.PressMinus();
|
|
||||||
scientificCalculator.Press3();
|
|
||||||
scientificCalculator.PressPlus();
|
|
||||||
scientificCalculator.Press1();
|
|
||||||
scientificCalculator.PressEquals();
|
|
||||||
|
|
||||||
Verify.AreEqual("\u202D0\u202C", scientificCalculator.ObjectModel.Display.Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public class Constants
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The path to the certificate file.
|
|
||||||
/// </summary>
|
|
||||||
public const string CertificateFileName = @"Calculator.cer";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The path to the appxbundle file.
|
|
||||||
/// </summary>
|
|
||||||
public const string PackageFileName = @"Calculator.appxbundle";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The path to the appxbundle file.
|
|
||||||
/// </summary>
|
|
||||||
public const string VCLibsPackageFileName = @"Microsoft.VCLibs.appx";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The path to the appxbundle file.
|
|
||||||
/// </summary>
|
|
||||||
public const string WinUIPackageFileName = @"Microsoft.UI.Xaml.appx";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name of the CoreWindow.
|
|
||||||
/// </summary>
|
|
||||||
public const string AppWindowName = "Calculator";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name of the process executable.
|
|
||||||
/// </summary>
|
|
||||||
public const string ProcessName = "Calculator.exe";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The package name.
|
|
||||||
/// </summary>
|
|
||||||
public const string PackageName = "Microsoft.WindowsCalculator";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The package family name for the app to test.
|
|
||||||
/// </summary>
|
|
||||||
public const string PackageFamilyName = PackageName + "_8wekyb3d8bbwe";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The package App User Model Id.
|
|
||||||
/// </summary>
|
|
||||||
public const string PackageAppUserModelId = PackageFamilyName + "!App";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AutomationId for the top level UI element.
|
|
||||||
/// </summary>
|
|
||||||
public const string TopLevelWindowAutomationId = "CalculatorWindow";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event fired when the first page is loaded.
|
|
||||||
/// </summary>
|
|
||||||
public const string AppLaunchEndETWEventName = "AppLaunchEnd";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// App Provider GUID for ETW Events
|
|
||||||
/// </summary>
|
|
||||||
public static readonly Guid CalculatorETWProviderGUID = new Guid("0905CA09-610E-401E-B650-2F212980B9E0");
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event fired when a calculator mode change is complete.
|
|
||||||
/// </summary>
|
|
||||||
public const string AppModeChangeEndETWEventName = "ModeChangeEnd";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event fired when the History panel is opened by flyout or by changing pivot tabs.
|
|
||||||
/// </summary>
|
|
||||||
public const string HistoryBodyOpenedETWEventName = "HistoryBodyOpened";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event fired when the Memory panel is opened by flyout or by changing pivot tabs.
|
|
||||||
/// </summary>
|
|
||||||
public const string MemoryBodyOpenedETWEventName = "MemoryBodyOpened";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event fired when the About flyout control is loaded.
|
|
||||||
/// </summary>
|
|
||||||
public const string AboutFlyoutOpenedETWEventName = "AboutFlyoutOpened";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Event fired when the Nav Bar control is opened.
|
|
||||||
/// </summary>
|
|
||||||
public const string NavBarOpenedETWEventName = "NavBarOpened";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Margin used to click in the gutter beneath the History and Memory lists
|
|
||||||
/// </summary>
|
|
||||||
public const int ClickMargin = 10;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.OneCoreUap.Test.AppModel;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public class EtwHelper
|
|
||||||
{
|
|
||||||
private static bool etwServiceWasInstalled = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Installs and starts the Etw.Service so that Tests may utilize Etw Waiters.
|
|
||||||
/// Wex.Services.exe is part of TAEF.
|
|
||||||
/// </summary>
|
|
||||||
public static void InstallAndStartETWService()
|
|
||||||
{
|
|
||||||
etwServiceWasInstalled = ServiceHelper.IsInstalled("Etw.Service");
|
|
||||||
if (!etwServiceWasInstalled)
|
|
||||||
{
|
|
||||||
string wexServices = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), "Wex.Services.exe");
|
|
||||||
if (!File.Exists(wexServices))
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException(wexServices);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.Comment("Attempting to install Etw.Service...");
|
|
||||||
var startInfo = new ProcessStartInfo();
|
|
||||||
startInfo.FileName = wexServices;
|
|
||||||
startInfo.Arguments = "/install:Etw.Service";
|
|
||||||
|
|
||||||
var process = new Process();
|
|
||||||
process.StartInfo = startInfo;
|
|
||||||
if (process.Start())
|
|
||||||
{
|
|
||||||
process.WaitForExit();
|
|
||||||
Log.Comment("Completed installation of Etw.Service");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception("ETW service was not able to be installed. Process didn't start.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.Comment("Attempting to start Etw.Service...");
|
|
||||||
ServiceHelper.Start("Etw.Service");
|
|
||||||
Log.Comment("Etw.Service started");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stops the Etw.Service.
|
|
||||||
/// </summary>
|
|
||||||
public static void StopAndRemoveETWService()
|
|
||||||
{
|
|
||||||
if (ServiceHelper.IsInstalled("Etw.Service"))
|
|
||||||
{
|
|
||||||
Log.Comment("Attempting to stop Etw.Service...");
|
|
||||||
ServiceHelper.Stop("Etw.Service");
|
|
||||||
Log.Comment("Etw.Service stopped");
|
|
||||||
|
|
||||||
// if we installed the Etw.Service as part of this test we should also remove it.
|
|
||||||
// This prevents cases where TDP is upgraded but the service tregistration is referencing the old
|
|
||||||
// location that no longer exists.
|
|
||||||
if (!etwServiceWasInstalled)
|
|
||||||
{
|
|
||||||
|
|
||||||
string wexServices = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), "Wex.Services.exe");
|
|
||||||
if (!File.Exists(wexServices))
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException(wexServices);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.Comment("Attempting to remove Etw.Service...");
|
|
||||||
var startInfo = new ProcessStartInfo();
|
|
||||||
startInfo.FileName = wexServices;
|
|
||||||
startInfo.Arguments = "/remove:Etw.Service";
|
|
||||||
|
|
||||||
var process = new Process();
|
|
||||||
process.StartInfo = startInfo;
|
|
||||||
if (process.Start())
|
|
||||||
{
|
|
||||||
process.WaitForExit();
|
|
||||||
Log.Comment("Completed removal of Etw.Service");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception("ETW service could not be removed. Process didn't start.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Microsoft.Win32.SafeHandles;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Security.Principal;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public static class Impersonater
|
|
||||||
{
|
|
||||||
public static void RunAs(RunAsUser user, Action action)
|
|
||||||
{
|
|
||||||
IntPtr errorInfo;
|
|
||||||
SafeAccessTokenHandle restrictedToken;
|
|
||||||
GetRunAsUserToken getRunAsUserToken = ResolveGetRunAsUserTokenMethod();
|
|
||||||
Marshal.ThrowExceptionForHR(getRunAsUserToken(user, out restrictedToken, out errorInfo), errorInfo);
|
|
||||||
|
|
||||||
WindowsIdentity.RunImpersonated(restrictedToken, action);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RunAs<T>(RunAsUser user, Func<T> function)
|
|
||||||
{
|
|
||||||
IntPtr errorInfo;
|
|
||||||
SafeAccessTokenHandle restrictedToken;
|
|
||||||
GetRunAsUserToken getRunAsUserToken = ResolveGetRunAsUserTokenMethod();
|
|
||||||
Marshal.ThrowExceptionForHR(getRunAsUserToken(user, out restrictedToken, out errorInfo), errorInfo);
|
|
||||||
|
|
||||||
WindowsIdentity.RunImpersonated(restrictedToken, function);
|
|
||||||
}
|
|
||||||
|
|
||||||
// From: https://microsoft.visualstudio.com/EngSys/_git/validation.taef?path=%2Fsrc%2FTAEF%2FCommon%2FPublished%2FRunAsFromSystem.h&version=GBdevelop
|
|
||||||
public enum RunAsUser
|
|
||||||
{
|
|
||||||
ElevatedUser,
|
|
||||||
User,
|
|
||||||
RestrictedUser,
|
|
||||||
LowIL,
|
|
||||||
InteractiveUser,
|
|
||||||
};
|
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
||||||
private delegate int GetRunAsUserToken(RunAsUser user, out SafeAccessTokenHandle token, out IntPtr errorInfo);
|
|
||||||
|
|
||||||
// GetRunAsUserToken is defined in a namespace so we have to do some tricks to use P/Invoke.
|
|
||||||
// We got the actual exported method name by running dumpbin /exports TE.Common.dll
|
|
||||||
private static GetRunAsUserToken ResolveGetRunAsUserTokenMethod()
|
|
||||||
{
|
|
||||||
IntPtr teCommonDll = IntPtr.Zero;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
teCommonDll = LoadLibrary(@"TE.Common.dll");
|
|
||||||
|
|
||||||
IntPtr x64GetRunAsUserToken = GetProcAddress(teCommonDll, "?GetRunAsUserToken@TestExecution@WEX@@YAJW4RunAsUser@12@PEAPEAXPEAPEAUIErrorInfo@@@Z");
|
|
||||||
if (x64GetRunAsUserToken != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
return Marshal.GetDelegateForFunctionPointer<GetRunAsUserToken>(x64GetRunAsUserToken);
|
|
||||||
}
|
|
||||||
IntPtr x86GetRunAsUserToken = GetProcAddress(teCommonDll, "?GetRunAsUserToken@TestExecution@WEX@@YGJW4RunAsUser@12@PAPAXPAPAUIErrorInfo@@@Z");
|
|
||||||
if (x86GetRunAsUserToken != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
return Marshal.GetDelegateForFunctionPointer<GetRunAsUserToken>(x86GetRunAsUserToken);
|
|
||||||
}
|
|
||||||
IntPtr armGetRunAsUserToken = GetProcAddress(teCommonDll, "?GetRunAsUserToken@TestExecution@WEX@@YAJW4RunAsUser@12@PAPAXPAPAUIErrorInfo@@@Z");
|
|
||||||
if (armGetRunAsUserToken != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
return Marshal.GetDelegateForFunctionPointer<GetRunAsUserToken>(armGetRunAsUserToken);
|
|
||||||
}
|
|
||||||
IntPtr arm64GetRunAsUserToken = GetProcAddress(teCommonDll, "?GetRunAsUserToken@TestExecution@WEX@@YAJW4RunAsUser@12@PEAPEAXPEAPEAUIErrorInfo@@@Z");
|
|
||||||
if (arm64GetRunAsUserToken != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
return Marshal.GetDelegateForFunctionPointer<GetRunAsUserToken>(arm64GetRunAsUserToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Exception("Unable to find the GetRunAsUserToken function in DLL 'TE.Common.dll'");
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (teCommonDll != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
FreeLibrary(teCommonDll);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
public static extern IntPtr LoadLibrary(string dllToLoad);
|
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
|
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
public static extern bool FreeLibrary(IntPtr hModule);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Threading;
|
|
||||||
using Microsoft.OneCoreUap.Test.AppModel;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
using Windows.Foundation;
|
|
||||||
using Windows.Management.Deployment;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public class InstallHelper
|
|
||||||
{
|
|
||||||
public static void InstallCertFile(string certFilePath)
|
|
||||||
{
|
|
||||||
// Ensure cert exists.
|
|
||||||
if (!File.Exists(certFilePath))
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException(certFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For some reason, attempting to use CertificateHelper.InstallFromSignedPackage() to install
|
|
||||||
// the certificate associated with the appx package fails with the error:
|
|
||||||
// "A certificate chain could not be built to a trusted root authority."
|
|
||||||
// The reason is that the cert needs to be installed in 'StoreName.TrustedPeople',
|
|
||||||
// but DeploymentHelper.AddPackage() attempts to install it in 'StoreName.Root'.
|
|
||||||
// Therefore, the cert has been installed manually beforehand.
|
|
||||||
Log.Comment($"Starting install of certificate at {certFilePath}");
|
|
||||||
|
|
||||||
X509Certificate2 certificate = new X509Certificate2(certFilePath);
|
|
||||||
X509Store trustedPeopleStore = new X509Store(StoreName.TrustedPeople, StoreLocation.LocalMachine);
|
|
||||||
trustedPeopleStore.Open(OpenFlags.MaxAllowed);
|
|
||||||
trustedPeopleStore.Add(certificate);
|
|
||||||
|
|
||||||
Log.Comment($"Completed install of certificate");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Upgrades the appx/appxbundle from the path if needed.
|
|
||||||
/// </summary>
|
|
||||||
public static void InstallPackage(string appxFilePath, params string[] dependencyAppxFilePaths)
|
|
||||||
{
|
|
||||||
// Ensure the files exist.
|
|
||||||
if (!File.Exists(appxFilePath))
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException(appxFilePath);
|
|
||||||
}
|
|
||||||
foreach (var path in dependencyAppxFilePaths.Where(p => !File.Exists(p)))
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.Comment($"Starting install of app package at {appxFilePath}");
|
|
||||||
|
|
||||||
PackageManager packageManager = new PackageManager();
|
|
||||||
var deploymentOperation = packageManager.AddPackageAsync(
|
|
||||||
new Uri(appxFilePath),
|
|
||||||
dependencyAppxFilePaths.Select(d => new Uri(d)),
|
|
||||||
DeploymentOptions.ForceApplicationShutdown | DeploymentOptions.ForceTargetApplicationShutdown | DeploymentOptions.ForceUpdateFromAnyVersion);
|
|
||||||
|
|
||||||
WaitForDeploymentOperation(deploymentOperation);
|
|
||||||
|
|
||||||
Log.Comment("Completed install of app package");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Waits for a deployment operation to complete
|
|
||||||
/// </summary>
|
|
||||||
private static void WaitForDeploymentOperation(IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> operation)
|
|
||||||
{
|
|
||||||
ManualResetEvent isCompletedEvent = new ManualResetEvent(false);
|
|
||||||
operation.Completed = (IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> asyncInfo, AsyncStatus asyncStatus) =>
|
|
||||||
{
|
|
||||||
isCompletedEvent.Set();
|
|
||||||
};
|
|
||||||
|
|
||||||
isCompletedEvent.WaitOne();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
internal static class NativeMethods
|
|
||||||
{
|
|
||||||
internal const int GW_OWNER = 4;
|
|
||||||
|
|
||||||
internal delegate bool EnumThreadWindowsCallback(IntPtr hWnd, IntPtr lParam);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern bool EnumWindows(EnumThreadWindowsCallback callback, IntPtr extraData);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern int GetWindowThreadProcessId(IntPtr handle, out int processId);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern int GetWindowTextLength(IntPtr hWnd);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern bool IsWindowVisible(IntPtr hWnd);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true)]
|
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal static extern bool StartService(IntPtr hService, int dwNumServiceArgs, string[] lpServiceArgVectors);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true)]
|
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal static extern bool ControlService(IntPtr hService, SERVICE_CONTROL dwControl, ref SERVICE_STATUS lpServiceStatus);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-service-management-l1-1-0.dll")]
|
|
||||||
internal static extern IntPtr OpenSCManager(string machineName, string databaseName, uint dwAccess);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true)]
|
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
|
||||||
internal static extern bool CloseServiceHandle(IntPtr hSCObject);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
|
||||||
internal static extern IntPtr OpenService(IntPtr hSCManager, string lpServiceName, uint dwDesiredAccess);
|
|
||||||
|
|
||||||
[DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true)]
|
|
||||||
internal static extern bool QueryServiceStatus(IntPtr hService, ref SERVICE_STATUS dwServiceStatus);
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
||||||
internal struct SERVICE_STATUS
|
|
||||||
{
|
|
||||||
public int dwServiceType;
|
|
||||||
public int dwCurrentState;
|
|
||||||
public int dwControlsAccepted;
|
|
||||||
public int dwWin32ExitCode;
|
|
||||||
public int dwServiceSpecificExitCode;
|
|
||||||
public int dwCheckPoint;
|
|
||||||
public int dwWaitHint;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static uint STANDARD_RIGHTS_REQUIRED = 0xF0000;
|
|
||||||
|
|
||||||
internal static uint SC_MANAGER_CONNECT = 0x0001;
|
|
||||||
internal static uint SC_MANAGER_CREATE_SERVICE = 0x0002;
|
|
||||||
internal static uint SC_MANAGER_ENUMERATE_SERVICE = 0x0004;
|
|
||||||
internal static uint SC_MANAGER_LOCK = 0x0008;
|
|
||||||
internal static uint SC_MANAGER_QUERY_LOCK_STATUS = 0x0010;
|
|
||||||
internal static uint SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020;
|
|
||||||
internal static uint SC_MANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED |
|
|
||||||
SC_MANAGER_CONNECT |
|
|
||||||
SC_MANAGER_CREATE_SERVICE |
|
|
||||||
SC_MANAGER_ENUMERATE_SERVICE |
|
|
||||||
SC_MANAGER_LOCK |
|
|
||||||
SC_MANAGER_QUERY_LOCK_STATUS |
|
|
||||||
SC_MANAGER_MODIFY_BOOT_CONFIG);
|
|
||||||
|
|
||||||
internal static uint SERVICE_QUERY_CONFIG = 0x0001;
|
|
||||||
internal static uint SERVICE_CHANGE_CONFIG = 0x0002;
|
|
||||||
internal static uint SERVICE_QUERY_STATUS = 0x0004;
|
|
||||||
internal static uint SERVICE_ENUMERATE_DEPENDENTS = 0x0008;
|
|
||||||
internal static uint SERVICE_START = 0x0010;
|
|
||||||
internal static uint SERVICE_STOP = 0x0020;
|
|
||||||
internal static uint SERVICE_PAUSE_CONTINUE = 0x0040;
|
|
||||||
internal static uint SERVICE_INTERROGATE = 0x0080;
|
|
||||||
internal static uint SERVICE_USER_DEFINED_CONTROL = 0x0100;
|
|
||||||
internal static uint SERVICE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED |
|
|
||||||
SERVICE_QUERY_CONFIG |
|
|
||||||
SERVICE_CHANGE_CONFIG |
|
|
||||||
SERVICE_QUERY_STATUS |
|
|
||||||
SERVICE_ENUMERATE_DEPENDENTS |
|
|
||||||
SERVICE_START |
|
|
||||||
SERVICE_STOP |
|
|
||||||
SERVICE_PAUSE_CONTINUE |
|
|
||||||
SERVICE_INTERROGATE |
|
|
||||||
SERVICE_USER_DEFINED_CONTROL);
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
internal enum SERVICE_CONTROL : uint
|
|
||||||
{
|
|
||||||
STOP = 0x00000001,
|
|
||||||
PAUSE = 0x00000002,
|
|
||||||
CONTINUE = 0x00000003,
|
|
||||||
INTERROGATE = 0x00000004,
|
|
||||||
SHUTDOWN = 0x00000005,
|
|
||||||
PARAMCHANGE = 0x00000006,
|
|
||||||
NETBINDADD = 0x00000007,
|
|
||||||
NETBINDREMOVE = 0x00000008,
|
|
||||||
NETBINDENABLE = 0x00000009,
|
|
||||||
NETBINDDISABLE = 0x0000000A,
|
|
||||||
DEVICEEVENT = 0x0000000B,
|
|
||||||
HARDWAREPROFILECHANGE = 0x0000000C,
|
|
||||||
POWEREVENT = 0x0000000D,
|
|
||||||
SESSIONCHANGE = 0x0000000E
|
|
||||||
}
|
|
||||||
|
|
||||||
internal enum SERVICE_STATE : int
|
|
||||||
{
|
|
||||||
SERVICE_STOPPED = 0x00000001,
|
|
||||||
SERVICE_START_PENDING = 0x00000002,
|
|
||||||
SERVICE_STOP_PENDING = 0x00000003,
|
|
||||||
SERVICE_RUNNING = 0x00000004,
|
|
||||||
SERVICE_CONTINUE_PENDING = 0x00000005,
|
|
||||||
SERVICE_PAUSE_PENDING = 0x00000006,
|
|
||||||
SERVICE_PAUSED = 0x00000007
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public class PerfConstants
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Path where the regions, wprprofiles and wpaprofiles will be deployed to by the spkg.
|
|
||||||
/// </summary>
|
|
||||||
public const string ConfigDirectory = @"Config\";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Our FunGates source, where we can view test results.
|
|
||||||
/// </summary>
|
|
||||||
public const string FunGatesSource =
|
|
||||||
#if DEBUG
|
|
||||||
"TestSite";
|
|
||||||
#else
|
|
||||||
"Utility Apps Performance Tests";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The Windows Performance Recorder profile. These strings must have the config directory prefix.
|
|
||||||
/// For use with the WPRProfileFile test attribute.
|
|
||||||
/// </summary>
|
|
||||||
public const string AppLifecycleWPRProfile = ConfigDirectory + "AppLifecycle.Profile.wprp";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The regions of interest file that contains the events we are interested in measuring.
|
|
||||||
/// </summary>
|
|
||||||
public const string AppLifecycleRegions = ConfigDirectory + "AppLifecycle.regions.xml";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// These are uses with the DataSource test property to specify iteration info.
|
|
||||||
/// </summary>
|
|
||||||
public const string AppLifecycleIterationsSource = "Table:" + ConfigDirectory + "AppLifecycle.Iterations.xml#PerformanceConfigurations";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,156 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public class ServiceHelper
|
|
||||||
{
|
|
||||||
public static void Start(string serviceName, int timeoutInMilliSeconds = 30000)
|
|
||||||
{
|
|
||||||
IntPtr hService = IntPtr.Zero;
|
|
||||||
IntPtr hSCManager = IntPtr.Zero;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
hSCManager = NativeMethods.OpenSCManager(null, null, NativeMethods.SC_MANAGER_ALL_ACCESS);
|
|
||||||
if (IntPtr.Zero == hSCManager)
|
|
||||||
{
|
|
||||||
throw new Exception($"Start: Cannot Open OpenSCManager, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
hService = NativeMethods.OpenService(hSCManager, serviceName, NativeMethods.SERVICE_ALL_ACCESS);
|
|
||||||
if (IntPtr.Zero == hService)
|
|
||||||
{
|
|
||||||
throw new Exception($"Start: Cannot Open Service, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
NativeMethods.SERVICE_STATUS serviceStatus = new NativeMethods.SERVICE_STATUS();
|
|
||||||
if (!NativeMethods.QueryServiceStatus(hService, ref serviceStatus))
|
|
||||||
{
|
|
||||||
throw new Exception($"Start: Unable to query status of Service, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serviceStatus.dwCurrentState != (int)NativeMethods.SERVICE_STATE.SERVICE_RUNNING &&
|
|
||||||
serviceStatus.dwCurrentState != (int)NativeMethods.SERVICE_STATE.SERVICE_START_PENDING)
|
|
||||||
{
|
|
||||||
if (!NativeMethods.StartService(hService, 0, null))
|
|
||||||
{
|
|
||||||
throw new Exception($"Start: Service cannot be started, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitForStatus(hService, NativeMethods.SERVICE_STATE.SERVICE_RUNNING, TimeSpan.FromMilliseconds(timeoutInMilliSeconds));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (IntPtr.Zero != hService)
|
|
||||||
{
|
|
||||||
NativeMethods.CloseServiceHandle(hService);
|
|
||||||
}
|
|
||||||
if (IntPtr.Zero != hSCManager)
|
|
||||||
{
|
|
||||||
NativeMethods.CloseServiceHandle(hSCManager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Stop(string serviceName, int timeoutInMilliSeconds = 30000)
|
|
||||||
{
|
|
||||||
IntPtr hSCManager = IntPtr.Zero;
|
|
||||||
IntPtr hService = IntPtr.Zero;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
hSCManager = NativeMethods.OpenSCManager(null, null, NativeMethods.SC_MANAGER_ALL_ACCESS);
|
|
||||||
if (IntPtr.Zero == hSCManager)
|
|
||||||
{
|
|
||||||
throw new Exception($"Stop: Cannot Open OpenSCManager, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
hService = NativeMethods.OpenService(hSCManager, serviceName, NativeMethods.SERVICE_ALL_ACCESS);
|
|
||||||
if (IntPtr.Zero == hService)
|
|
||||||
{
|
|
||||||
throw new Exception($"Stop: Cannot Open Service, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
NativeMethods.SERVICE_STATUS serviceStatus = new NativeMethods.SERVICE_STATUS();
|
|
||||||
if (!NativeMethods.QueryServiceStatus(hService, ref serviceStatus))
|
|
||||||
{
|
|
||||||
throw new Exception($"Stop: Unable to query status of Service, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serviceStatus.dwCurrentState != (int)NativeMethods.SERVICE_STATE.SERVICE_STOPPED &&
|
|
||||||
serviceStatus.dwCurrentState != (int)NativeMethods.SERVICE_STATE.SERVICE_STOP_PENDING)
|
|
||||||
{
|
|
||||||
if (!NativeMethods.ControlService(hService, NativeMethods.SERVICE_CONTROL.STOP, ref serviceStatus))
|
|
||||||
{
|
|
||||||
throw new Exception($"Stop: Service cannot be stopped, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WaitForStatus(hService, NativeMethods.SERVICE_STATE.SERVICE_STOPPED, TimeSpan.FromMilliseconds(timeoutInMilliSeconds));
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (IntPtr.Zero != hService)
|
|
||||||
{
|
|
||||||
NativeMethods.CloseServiceHandle(hService);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IntPtr.Zero != hSCManager)
|
|
||||||
{
|
|
||||||
NativeMethods.CloseServiceHandle(hSCManager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsInstalled(string svcName)
|
|
||||||
{
|
|
||||||
IntPtr sc_handle = NativeMethods.OpenSCManager(null, null, NativeMethods.SC_MANAGER_ALL_ACCESS);
|
|
||||||
if (sc_handle == IntPtr.Zero)
|
|
||||||
{
|
|
||||||
throw new Exception($"IsInstalled: Cannot open service manager, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool bResult = false;
|
|
||||||
IntPtr sv_handle = NativeMethods.OpenService(sc_handle, svcName, NativeMethods.SERVICE_QUERY_CONFIG);
|
|
||||||
if (sv_handle.ToInt64() != 0)
|
|
||||||
{
|
|
||||||
bResult = true;
|
|
||||||
NativeMethods.CloseServiceHandle(sv_handle);
|
|
||||||
}
|
|
||||||
NativeMethods.CloseServiceHandle(sc_handle);
|
|
||||||
return bResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void WaitForStatus(IntPtr hService, NativeMethods.SERVICE_STATE desiredStatus, TimeSpan timeout)
|
|
||||||
{
|
|
||||||
Stopwatch swLoop = new Stopwatch();
|
|
||||||
swLoop.Start();
|
|
||||||
|
|
||||||
NativeMethods.SERVICE_STATUS serviceStatus = new NativeMethods.SERVICE_STATUS();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
if (!NativeMethods.QueryServiceStatus(hService, ref serviceStatus))
|
|
||||||
{
|
|
||||||
throw new Exception($"WaitForStatus: Unable to query status of service, {Marshal.GetLastWin32Error()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (serviceStatus.dwCurrentState != (int)desiredStatus && (swLoop.ElapsedMilliseconds <= timeout.TotalMilliseconds));
|
|
||||||
|
|
||||||
if (serviceStatus.dwCurrentState != (int)desiredStatus)
|
|
||||||
{
|
|
||||||
throw new Exception($"WaitForStatus: Service failed to reach desired state: {desiredStatus}, current state: {serviceStatus.dwCurrentState}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Automation;
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public static class UIObjectExtensions
|
|
||||||
{
|
|
||||||
private const string NamePropertyName = "Name";
|
|
||||||
private static UICondition CoreWindowCondition = UICondition.CreateFromClassName("Windows.UI.Core.CoreWindow");
|
|
||||||
|
|
||||||
public static Window GetParentCoreWindow(this UIObject uiObject)
|
|
||||||
{
|
|
||||||
if (uiObject.Matches(CoreWindowCondition))
|
|
||||||
{
|
|
||||||
return new Window(uiObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Window(uiObject.Ancestors.Find(CoreWindowCondition));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Window GetTopLevelWindow(this Window window)
|
|
||||||
{
|
|
||||||
var node = window;
|
|
||||||
while (node != null && node.Parent != null && node.Parent.ControlType == ControlType.Window)
|
|
||||||
{
|
|
||||||
node = new Window(node.Parent);
|
|
||||||
}
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void VerifyParentTreeStructure(this UIObject uiObject)
|
|
||||||
{
|
|
||||||
var node = uiObject;
|
|
||||||
while (node != null && node.Parent != null)
|
|
||||||
{
|
|
||||||
if (!node.Parent.Children.Contains(node))
|
|
||||||
{
|
|
||||||
Log.Comment($"- [VerifyingTree] {node} specifies {node.Parent} as parent but is not part of its children.");
|
|
||||||
}
|
|
||||||
if (!node.Parent.Descendants.Contains(node))
|
|
||||||
{
|
|
||||||
Log.Comment($"- [VerifyingTree] {node} specifies {node.Parent} as parent but is not part of its descendants.");
|
|
||||||
}
|
|
||||||
node = node.Parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool DoesDescendantExist(this UIObject uiObject, string automationId)
|
|
||||||
{
|
|
||||||
UIObject temp;
|
|
||||||
return uiObject.Descendants.TryFind(automationId, out temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PropertyChangedEventWaiter GetNameChangedWaiter(this TextBlock textBlock)
|
|
||||||
{
|
|
||||||
return new PropertyChangedEventWaiter(textBlock, UIProperty.Get(NamePropertyName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public class Utilities
|
|
||||||
{
|
|
||||||
public static void KillExistingCalculatorProcesses()
|
|
||||||
{
|
|
||||||
Log.Comment("Killing any existing Calculator processes");
|
|
||||||
|
|
||||||
foreach (var process in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Constants.ProcessName)))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
process.Kill();
|
|
||||||
Log.Comment($"Killed {process.ProcessName}, Id: {process.Id}");
|
|
||||||
}
|
|
||||||
catch (Exception) when (process.HasExited)
|
|
||||||
{
|
|
||||||
Log.Comment($"{process.ProcessName}, Id: {process.Id} already exited.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
|
|
||||||
namespace Calculator.UIAutomationLibrary
|
|
||||||
{
|
|
||||||
public class WindowHelper
|
|
||||||
{
|
|
||||||
public static void SetAsForeground(Window window)
|
|
||||||
{
|
|
||||||
Log.Comment($"Set window {window.NativeWindowHandle} as the foreground window.");
|
|
||||||
|
|
||||||
NativeMethods.SetForegroundWindow(window.NativeWindowHandle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"AppModel.TestHelper": "2018.3.22",
|
|
||||||
"EtwProcessor.Managed": "10.34.181220007",
|
|
||||||
"MITALite": "1.0.180128001",
|
|
||||||
"Taef.Managed": "10.34.181220007",
|
|
||||||
"Test.Net.Redist": "2.0.1"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"netcore50": {}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,145 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProjectGuid>{0224A709-0C48-4C4F-BA17-843A49842C15}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Calculator.UITests</RootNamespace>
|
|
||||||
<AssemblyName>Calculator.UITests</AssemblyName>
|
|
||||||
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
|
|
||||||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
|
||||||
<NuGetTargetMoniker>.NETCore,Version=v5.0</NuGetTargetMoniker>
|
|
||||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
|
||||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
|
|
||||||
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<CopyNuGetImplementations>true</CopyNuGetImplementations>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\x86</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\x86</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\x64</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\x64</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\arm</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>ARM</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\arm</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>ARM</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM64' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\ARM64\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>ARM64</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM64' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\ARM64\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<PlatformTarget>ARM64</PlatformTarget>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Initialization.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Tests\AppLifecycleTests.cs" />
|
|
||||||
<Compile Include="Tests\CalculatorTests.cs" />
|
|
||||||
<Compile Include="Tests\LaunchTests.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Config\AppLifecycle.Profile.wprp">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="Config\AppLifecycle.Regions.tt">
|
|
||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
|
||||||
<LastGenOutput>AppLifecycle.Regions.xml</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Content>
|
|
||||||
<Content Include="Config\AppLifecycle.Regions.xml">
|
|
||||||
<DependentUpon>AppLifecycle.Regions.tt</DependentUpon>
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
</Content>
|
|
||||||
<None Include="project.json" />
|
|
||||||
<None Include="testmd.definition" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Calculator.UIAutomationLibrary\Calculator.UIAutomationLibrary.csproj">
|
|
||||||
<Project>{a43517b5-8be3-4312-913f-004978c34444}</Project>
|
|
||||||
<Name>Calculator.UIAutomationLibrary</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Config\AppLifecycle.Iterations.xml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0' ">
|
|
||||||
<VisualStudioVersion>15.0</VisualStudioVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
@ -1,40 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This file defines a table of performance configuration for use with
|
|
||||||
TAEF Table Based Data-driven Testing.
|
|
||||||
|
|
||||||
This table specifies we will run the test three times (each iteration has a
|
|
||||||
unique name to identify the scenario) with different parameters each time.
|
|
||||||
We use the same region file for WinPerf but we specify different WPR profiles
|
|
||||||
to capture ETW events from different providers, focusing on responsiveness for
|
|
||||||
launch runs and on memory for one diagnostic memory run.
|
|
||||||
|
|
||||||
The warm run is the one we are primarily interested in for startup performance.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<Data>
|
|
||||||
<Table Id="PerformanceConfigurations">
|
|
||||||
<Row Name="Cold"
|
|
||||||
WinPerf.FriendlyAutomationName="AppLifecycle_Responsiveness_Cold"
|
|
||||||
WinPerf.Iterations="1"
|
|
||||||
WinPerf.WPRProfile="Config\AppLifecycle.Profile.wprp"
|
|
||||||
WinPerf.WPRProfileId="AppLifecycle.Responsiveness.Diagnostic.Verbose.File"
|
|
||||||
WinPerf.Regions="Config\AppLifecycle.Regions.xml">
|
|
||||||
</Row>
|
|
||||||
<Row Name="Warm"
|
|
||||||
WinPerf.FriendlyAutomationName="AppLifecycle_Responsiveness_Warm"
|
|
||||||
WinPerf.Iterations="10"
|
|
||||||
WinPerf.WPRProfile="Config\AppLifecycle.Profile.wprp"
|
|
||||||
WinPerf.WPRProfileId="AppLifecycle.Responsiveness.Diagnostic.Verbose.Memory"
|
|
||||||
WinPerf.Regions="Config\AppLifecycle.Regions.xml">
|
|
||||||
</Row>
|
|
||||||
<Row Name="Memory"
|
|
||||||
WinPerf.FriendlyAutomationName="AppLifecycle_Memory"
|
|
||||||
WinPerf.Iterations="1"
|
|
||||||
WinPerf.WPRProfile="Config\AppLifecycle.Profile.wprp"
|
|
||||||
WinPerf.WPRProfileId="AppLifecycle.Memory.Diagnostic.Verbose.File"
|
|
||||||
WinPerf.Regions="Config\AppLifecycle.Regions.xml">
|
|
||||||
</Row>
|
|
||||||
</Table>
|
|
||||||
</Data>
|
|
@ -1,526 +0,0 @@
|
|||||||
<!--
|
|
||||||
|
|
||||||
This WPRP (WPR profile) contains the App Life Cycle settings for Mobile and Client Performance Gates (MPG and CPG).
|
|
||||||
Since the appcycle automations are currently still separate, any changes here should be made in two places to keep these wprp's in sync.
|
|
||||||
CPG: base\PerfTest\MemRe\AppLifecycle\Common\AppLifeCycle.wprp
|
|
||||||
MPG: wm\src\tools\Product\DH\Test\PerfWorkloads\AppLifeCycle\AppLifeCycle.wprp
|
|
||||||
|
|
||||||
Prefixes in the WPRP:
|
|
||||||
SC_ - System Collector controlling kernel event tracing
|
|
||||||
EC_ - Event Collector controlling user mode event tracing
|
|
||||||
|
|
||||||
SP_ - System Provider
|
|
||||||
|
|
||||||
EP_ - Event Provider
|
|
||||||
|
|
||||||
There are two separate traces - Responsiveness and Memory.
|
|
||||||
Within that, we have Light tracing which is for official gating metrics/traces, and we have Verbose tracing, which is for Diagnostic metrics\traces.
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<WindowsPerformanceRecorder Version="1.0" Comments="Test" Company="Microsoft Corporation" Copyright="Microsoft Corporation">
|
|
||||||
<Profiles>
|
|
||||||
<!-- BufferSizes are in KB in WPRP -->
|
|
||||||
|
|
||||||
<!-- System Collectors -->
|
|
||||||
<SystemCollector Id="SC_Responsiveness.LowCost.Light" Name="NT Kernel Resposiveness Logger LowCost Light">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="3" PercentageOfTotalMemory="true" MaximumBufferSpace="30" />
|
|
||||||
</SystemCollector>
|
|
||||||
|
|
||||||
<SystemCollector Id="SC_Responsiveness.LowCost" Name="NT Kernel Resposiveness Logger LowCost">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="35" />
|
|
||||||
</SystemCollector>
|
|
||||||
|
|
||||||
<SystemCollector Id="SC_Responsiveness.HighCost.Verbose" Name="NT Kernel Resposiveness Logger HighCost Verbose">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="7" PercentageOfTotalMemory="true" MaximumBufferSpace="140" />
|
|
||||||
</SystemCollector>
|
|
||||||
|
|
||||||
<SystemCollector Id="SC_Memory.LowCost.Light" Name="NT Kernel Memory Logger LowCost Light">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="35" />
|
|
||||||
</SystemCollector>
|
|
||||||
|
|
||||||
<SystemCollector Id="SC_Memory.HighCost.Verbose" Name="NT Kernel Memory Logger LowCost Light">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="75" />
|
|
||||||
</SystemCollector>
|
|
||||||
|
|
||||||
<!-- Event Collectors -->
|
|
||||||
<EventCollector Id="EC_Responsiveness.LowCost.Light" Name="User Session Logger LowCost Light">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="2" PercentageOfTotalMemory="true" MaximumBufferSpace="20"/>
|
|
||||||
</EventCollector>
|
|
||||||
|
|
||||||
<EventCollector Id="EC_Responsiveness.LowCost.Light.UTC" Name="User Session Logger LowCost Light UTC">
|
|
||||||
<BufferSize Value="1024"/>
|
|
||||||
<Buffers Value="5"/>
|
|
||||||
</EventCollector>
|
|
||||||
|
|
||||||
<EventCollector Id="EC_Responsiveness.LowCost" Name="User Session Logger LowCost">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="15" />
|
|
||||||
</EventCollector>
|
|
||||||
|
|
||||||
<EventCollector Id="EC_Responsiveness.HighCost.Verbose" Name="User Session Logger HighCost Verbose">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="3" PercentageOfTotalMemory="true" MaximumBufferSpace="60" />
|
|
||||||
</EventCollector>
|
|
||||||
|
|
||||||
<EventCollector Id="EC_Memory.LowCost.Light" Name="User Session Logger LowCost Light">
|
|
||||||
<BufferSize Value="1024" />
|
|
||||||
<Buffers Value="30" />
|
|
||||||
</EventCollector>
|
|
||||||
|
|
||||||
<!-- System Providers for collecting kernel events. -->
|
|
||||||
<SystemProvider Id="SP_Responsiveness.Light">
|
|
||||||
<Keywords Operation="Add">
|
|
||||||
<Keyword Value="CompactCSwitch"/>
|
|
||||||
<Keyword Value="CSwitch"/>
|
|
||||||
<Keyword Value="DiskIO"/>
|
|
||||||
<Keyword Value="ProcessThread"/>
|
|
||||||
<Keyword Value="Loader"/>
|
|
||||||
</Keywords>
|
|
||||||
</SystemProvider>
|
|
||||||
<SystemProvider Id="SP_Responsiveness" Base="SP_Responsiveness.Light">
|
|
||||||
<Keywords Operation="Add">
|
|
||||||
<Keyword Value="HardFaults"/>
|
|
||||||
<Keyword Value="MemoryInfo"/>
|
|
||||||
<Keyword Value="ReadyThread"/>
|
|
||||||
<Keyword Value="SampledProfile"/>
|
|
||||||
<Keyword Value="Session"/>
|
|
||||||
<Keyword Value="VAMap"/>
|
|
||||||
<Keyword Value="DPC"/>
|
|
||||||
<Keyword Value="Power"/>
|
|
||||||
</Keywords>
|
|
||||||
<Stacks Operation="Add">
|
|
||||||
<Stack Value="CSwitch"/>
|
|
||||||
<Stack Value="ReadyThread"/>
|
|
||||||
<Stack Value="SampledProfile"/>
|
|
||||||
</Stacks>
|
|
||||||
</SystemProvider>
|
|
||||||
<SystemProvider Id="SP_Memory.Light" Base="SP_Responsiveness.Light" >
|
|
||||||
<Keywords Operation="Add">
|
|
||||||
<Keyword Value="Memory"/>
|
|
||||||
<Keyword Value="MemoryInfo"/>
|
|
||||||
<Keyword Value="HardFaults"/>
|
|
||||||
<Keyword Value="ReferenceSet"/>
|
|
||||||
<Keyword Value="VirtualAllocation"/>
|
|
||||||
</Keywords>
|
|
||||||
</SystemProvider>
|
|
||||||
<SystemProvider Id="SP_Memory" Base="SP_Responsiveness" >
|
|
||||||
<Keywords Operation="Add">
|
|
||||||
<Keyword Value="FootPrint"/>
|
|
||||||
<Keyword Value="Memory"/>
|
|
||||||
<Keyword Value="MemoryInfoWS"/>
|
|
||||||
<Keyword Value="ReferenceSet"/>
|
|
||||||
<Keyword Value="VirtualAllocation"/>
|
|
||||||
</Keywords>
|
|
||||||
<Stacks Operation="Add">
|
|
||||||
<Stack Value="HeapCreate" />
|
|
||||||
<Stack Value="ImageLoad" />
|
|
||||||
<Stack Value="PageAccess" />
|
|
||||||
<Stack Value="PageAccessEx" />
|
|
||||||
<Stack Value="PagefileMappedSectionCreate" />
|
|
||||||
<Stack Value="PagefileMappedSectionDelete" />
|
|
||||||
<Stack Value="PageRangeAccess" />
|
|
||||||
<Stack Value="PageRangeRelease" />
|
|
||||||
<Stack Value="PageRelease" />
|
|
||||||
<Stack Value="PageRemovedfromWorkingSet" />
|
|
||||||
<Stack Value="VirtualAllocation" />
|
|
||||||
<Stack Value="VirtualFree" />
|
|
||||||
</Stacks>
|
|
||||||
</SystemProvider>
|
|
||||||
<!-- Start - AppLaunch.wprp -->
|
|
||||||
<EventProvider Id="EP_UTC" Name="UTC" NonPagedMemory="true" Level="4" />
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsPhone-AppPlatProvider" Name="3C42000F-CC27-48C3-A005-48F6E38B131F" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_XNA" Name="CD698436-A3E3-4607-BB60-0BAC4D765B59" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_TaskHost" Name="5CBDF2A5-7290-4ACC-B8A7-9BA285BEBC39" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsPhone-Silverlight" Name="AA087E0E-0B35-4e28-8F3A-440C3F51EEF1" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Device-Health-Etw" Name="F7A8FD9F-8FFD-482f-86C0-4C19240F334C" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsMobile-Compositor" Name="85FFFBA1-CF12-402c-B9B3-29A3217BB007" Level="5">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0xfffffff" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsMobile-Splash" Name="872c8950-0def-4d5b-83f6-57dd027f88ce" Level="4">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0xfffffff" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsMobile-UIXMobile" Name="0C0FFEE0-F4B1-4F4D-B591-FB3175B13413">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0xE" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsMobile-StartMenu" Name="BECF83FD-D220-4b19-B7C1-C9127307F6B1" Level="5">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0xfffffff" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Kernel-EventTracing" Name="b675ec37-bdb6-4648-bc92-f3fdc74d3ca2" Level="5">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x50" />
|
|
||||||
</Keywords>
|
|
||||||
<CaptureStateOnSave>
|
|
||||||
<Keyword Value="0x50" />
|
|
||||||
</CaptureStateOnSave>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsPhone-MobileUI" Name="F243DC34-205E-4d34-94CA-36E8C0859787" Level="5">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0xfffffff" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Kernel-Process" Name="2839ff94-8f12-4e1b-82e3-af7af77a450f" NonPagedMemory="true" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-TestExecution" Name="Microsoft-Windows-TestExecution" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft.Windows.WinPerf" Name="BE6F04EA-3488-4543-8082-24843EAEC303" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Shell-Launcher" Name="*Microsoft-Windows-Shell-Launcher" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Immersive-Shell" Name="315A8872-923E-4EA2-9889-33CD4754BF64" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-XAML-Light" Name="531A35AB-63CE-4BCF-AA98-F88C7A89E455" Level="4" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-XAML-Verbose" Name="531A35AB-63CE-4BCF-AA98-F88C7A89E455" Level="5" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-ProcessLifetimeManager" Name="*Microsoft.Windows.ProcessLifetimeManager" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Desktop-ApplicationFrame" Name="678e492b-5de1-50c5-7219-ae4aa7d6a141" Level="5" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Microsoft-Phone-AppLifecycle" Name="f623a8ef-84da-4640-8917-fd5b0f847f28" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsPhone-CoreUIComponents" Name="a0b7550f-4e9a-4f03-ad41-b8042d06a2f7" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-AppModel-Exec" Name="EB65A492-86C0-406A-BACE-9912D595BD69" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft.Windows.ActivationManager" Name="cf7f94b3-08dc-5257-422f-497d7dc86ab3">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-WindowsMobile-ExecManLogPublisher" Name="82c8ad90-5f3c-11be-bd9a-85bb5f50dfa4" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Shell-CortanaSearch" Name="E34441D9-5BCF-4958-B787-3BF824F362D7" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Dwm-Core" Name="9e9bba3c-2e38-40cb-99f4-9e8281425164" Level="4" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x2000C"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-ImageLoad" Name="2cb15d1d-5fc1-11d2-abe1-00a0c911f518" >
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x10"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-AppLifeCycle-UI" Name="ee97cdc4-b095-5c70-6e37-a541eb74c2b5" Level="5">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x400000000000"/>
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-AppLifeCycle" Name="ef00584a-2655-462c-bc24-e7de630e7fbf">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0000000000000"/>
|
|
||||||
</Keywords>
|
|
||||||
<CaptureStateOnSave>
|
|
||||||
<Keyword Value="0x0000000000000"/>
|
|
||||||
</CaptureStateOnSave>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Kernel-Power" Name="331C3B3A-2005-44C2-AC5E-77220C37D6B4" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0xA4"/>
|
|
||||||
</Keywords>
|
|
||||||
<CaptureStateOnSave Timeout="0">
|
|
||||||
<Keyword Value="0xA4"/>
|
|
||||||
</CaptureStateOnSave>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Kernel-Processor-Power" Name="0f67e49f-fe51-4e9f-b490-6f2948cc6027" NonPagedMemory="true" EventKey="true" Level="4">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0xC2"/>
|
|
||||||
</Keywords>
|
|
||||||
<CaptureStateOnSave Timeout="0">
|
|
||||||
<Keyword Value="0xC2"/>
|
|
||||||
</CaptureStateOnSave>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Kernel-Pep" Name="5412704E-B2E1-4624-8FFD-55777B8F7373" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
<CaptureStateOnSave Timeout="0">
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</CaptureStateOnSave>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Kernel-Acpi" Name="C514638F-7723-485B-BCFC-96565D735D4A" Level="5" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
<CaptureStateOnSave>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</CaptureStateOnSave>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-UserModePowerService" Name="CE8DEE0B-D539-4000-B0F8-77BED049C590" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</Keywords>
|
|
||||||
<CaptureStateOnSave Timeout="0">
|
|
||||||
<Keyword Value="0x0"/>
|
|
||||||
</CaptureStateOnSave>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft.ClipC" Level="0" Name="ed0c10a5-5396-4a96-9ee3-6f4aa0d1120d" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x200000000000" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft.ClipSp" Level="0" Name="b4b126de-32fe-4591-9ac5-b0778d79a0e7" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x200000000000" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft.ClipSvc" Level="0" Name="b94d76c5-9d56-454a-8d1b-6ca30898160e" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x200000000000" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft.Windows.LicenseManager.Telemetry" Level="0" Name="af9f58ec-0c04-4be9-9eb5-55ff6dbe72d7" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x200000000000" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Win32k" Level="0" Name="8c416c79-d49b-4f01-a467-e56d3aa8234c" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x26A000" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<EventProvider Id="EP_Microsoft-Windows-Kernel-Prefetch" Level="0" Name="Microsoft-Windows-Kernel-Prefetch" NonPagedMemory="true" EventKey="true">
|
|
||||||
<Keywords>
|
|
||||||
<Keyword Value="0x0" />
|
|
||||||
</Keywords>
|
|
||||||
</EventProvider>
|
|
||||||
<!-- End - AppLaunch.wprp -->
|
|
||||||
<Profile Id="AppLifecycle.Responsiveness.Light.File" LoggingMode="File" Name="AppLifecycle.Responsiveness" DetailLevel="Light" Description="App lifecycle responsiveness light to file">
|
|
||||||
<Collectors>
|
|
||||||
<SystemCollectorId Value="SC_Responsiveness.LowCost.Light">
|
|
||||||
<SystemProviderId Value="SP_Responsiveness.Light" />
|
|
||||||
</SystemCollectorId>
|
|
||||||
<EventCollectorId Value="EC_Responsiveness.LowCost.Light">
|
|
||||||
<EventProviders>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-TestExecution" />
|
|
||||||
<EventProviderId Value="EP_Microsoft.Windows.WinPerf" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Immersive-Shell"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-AppLifeCycle" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Shell-Launcher" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-XAML-Light" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-AppLifeCycle-UI" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Process" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Shell-CortanaSearch"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-AppModel-Exec"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft.Windows.ActivationManager" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-EventTracing" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Desktop-ApplicationFrame" />
|
|
||||||
<EventProviderId Value="EP_XNA" />
|
|
||||||
<EventProviderId Value="EP_TaskHost" />
|
|
||||||
<EventProviderId Value="EP_Device-Health-Etw" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Microsoft-Phone-AppLifecycle"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-CoreUIComponents"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-AppPlatProvider" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-Silverlight" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-Splash" />
|
|
||||||
</EventProviders>
|
|
||||||
</EventCollectorId>
|
|
||||||
<EventCollectorId Value="EC_Responsiveness.LowCost.Light.UTC">
|
|
||||||
<EventProviders>
|
|
||||||
<EventProviderId Value="EP_UTC"/>
|
|
||||||
</EventProviders>
|
|
||||||
</EventCollectorId>
|
|
||||||
</Collectors>
|
|
||||||
</Profile>
|
|
||||||
<Profile Id="AppLifecycle.Responsiveness.Diagnostic.Verbose.File" Base="AppLifecycle.Responsiveness.Light.File" LoggingMode="File" Name="AppLifecycle.Responsiveness.Diagnostic" DetailLevel="Verbose" Description="App lifecycle responsiveness verbose to file">
|
|
||||||
<Collectors Operation="Add">
|
|
||||||
<SystemCollectorId Value="SC_Responsiveness.LowCost">
|
|
||||||
<SystemProviderId Value="SP_Responsiveness" />
|
|
||||||
</SystemCollectorId>
|
|
||||||
<EventCollectorId Value="EC_Responsiveness.LowCost">
|
|
||||||
<EventProviders>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-XAML-Verbose" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-ExecManLogPublisher"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-Compositor" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-UIXMobile" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-StartMenu" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-MobileUI" />
|
|
||||||
</EventProviders>
|
|
||||||
</EventCollectorId>
|
|
||||||
</Collectors>
|
|
||||||
</Profile>
|
|
||||||
<Profile Id="AppLifecycle.Responsiveness.Diagnostic.Verbose.Memory" Base="AppLifecycle.Responsiveness.Light.File" LoggingMode="Memory" Name="AppLifecycle.Responsiveness.Diagnostic" DetailLevel="Verbose" Description="App life cycle responsiveness verbose to memory">
|
|
||||||
<Collectors>
|
|
||||||
<SystemCollectorId Value="SC_Responsiveness.HighCost.Verbose">
|
|
||||||
<SystemProviderId Value="SP_Responsiveness"/>
|
|
||||||
</SystemCollectorId>
|
|
||||||
<EventCollectorId Value="EC_Responsiveness.HighCost.Verbose">
|
|
||||||
<EventProviders>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-ProcessLifetimeManager" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Shell-CortanaSearch"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-ExecManLogPublisher"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-Compositor" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-UIXMobile" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-StartMenu" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-MobileUI" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Power" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Processor-Power" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Pep" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Acpi" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-UserModePowerService" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Dwm-Core" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-ImageLoad" />
|
|
||||||
<EventProviderId Value="EP_Microsoft.ClipC" />
|
|
||||||
<EventProviderId Value="EP_Microsoft.ClipSp" />
|
|
||||||
<EventProviderId Value="EP_Microsoft.ClipSvc" />
|
|
||||||
<EventProviderId Value="EP_Microsoft.Windows.LicenseManager.Telemetry" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Win32k" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Prefetch" />
|
|
||||||
</EventProviders>
|
|
||||||
</EventCollectorId>
|
|
||||||
</Collectors>
|
|
||||||
</Profile>
|
|
||||||
<Profile Id="AppLifecycle.Memory.Light.File" LoggingMode="File" Name="AppLifecycle.Memory" DetailLevel="Light" Description="App lifecycle memory light to file">
|
|
||||||
<Collectors>
|
|
||||||
<SystemCollectorId Value="SC_Memory.LowCost.Light">
|
|
||||||
<SystemProviderId Value="SP_Memory.Light" />
|
|
||||||
</SystemCollectorId>
|
|
||||||
<EventCollectorId Value="EC_Memory.LowCost.Light">
|
|
||||||
<EventProviders>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-TestExecution" />
|
|
||||||
<EventProviderId Value="EP_Microsoft.Windows.WinPerf" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Immersive-Shell"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-AppModel-Exec"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft.Windows.ActivationManager" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-AppLifeCycle" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-AppLifeCycle-UI" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-EventTracing" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Desktop-ApplicationFrame" />
|
|
||||||
<EventProviderId Value="EP_XNA" />
|
|
||||||
<EventProviderId Value="EP_TaskHost" />
|
|
||||||
<EventProviderId Value="EP_Device-Health-Etw" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-ExecManLogPublisher"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Microsoft-Phone-AppLifecycle"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-CoreUIComponents"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-AppPlatProvider" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-Silverlight" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-XAML-Light" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-Splash" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Prefetch" />
|
|
||||||
</EventProviders>
|
|
||||||
</EventCollectorId>
|
|
||||||
<EventCollectorId Value="EC_Responsiveness.LowCost.Light.UTC">
|
|
||||||
<EventProviders>
|
|
||||||
<EventProviderId Value="EP_UTC"/>
|
|
||||||
</EventProviders>
|
|
||||||
</EventCollectorId>
|
|
||||||
</Collectors>
|
|
||||||
</Profile>
|
|
||||||
<Profile Id="AppLifecycle.Memory.Diagnostic.Verbose.File" Base="AppLifecycle.Memory.Light.File" LoggingMode="File" Name="AppLifecycle.Memory.Diagnostic" DetailLevel="Verbose" Description="App lifecycle memory verbose to file">
|
|
||||||
<Collectors Operation="Add">
|
|
||||||
<SystemCollectorId Value="SC_Memory.HighCost.Verbose">
|
|
||||||
<SystemProviderId Value="SP_Memory" />
|
|
||||||
</SystemCollectorId>
|
|
||||||
<EventCollectorId Value="EC_Memory.LowCost.Light">
|
|
||||||
<EventProviders>
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Shell-Launcher" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-XAML-Verbose" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Power" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Processor-Power" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Pep" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Dwm-Core" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-ImageLoad" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Kernel-Process" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-Shell-CortanaSearch"/>
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-Compositor" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-UIXMobile" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsMobile-StartMenu" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-WindowsPhone-MobileUI" />
|
|
||||||
<EventProviderId Value="EP_Microsoft-Windows-ProcessLifetimeManager" />
|
|
||||||
</EventProviders>
|
|
||||||
</EventCollectorId>
|
|
||||||
</Collectors>
|
|
||||||
</Profile>
|
|
||||||
</Profiles>
|
|
||||||
<TraceMergeProperties>
|
|
||||||
<TraceMergeProperty Id="TraceMerge_Default" Name="TraceMerge_Default" Base="">
|
|
||||||
<DeletePreMergedTraceFiles Value="true"/>
|
|
||||||
<CustomEvents>
|
|
||||||
<CustomEvent Value="ImageId"/>
|
|
||||||
<CustomEvent Value="BuildInfo"/>
|
|
||||||
<CustomEvent Value="VolumeMapping"/>
|
|
||||||
<CustomEvent Value="EventMetadata"/>
|
|
||||||
<CustomEvent Value="PerfTrackMetadata"/>
|
|
||||||
<CustomEvent Value="WinSAT"/>
|
|
||||||
<CustomEvent Value="NetworkInterface"/>
|
|
||||||
</CustomEvents>
|
|
||||||
</TraceMergeProperty>
|
|
||||||
</TraceMergeProperties>
|
|
||||||
</WindowsPerformanceRecorder>
|
|
@ -1,364 +0,0 @@
|
|||||||
<# // Copyright (c) Microsoft Corporation. All rights reserved. #>
|
|
||||||
<#@ template language="C#" hostspecific="True" #>
|
|
||||||
<#@ output extension=".xml" #>
|
|
||||||
<# // Set options specific to your app here
|
|
||||||
var options = new {
|
|
||||||
RegionPrefix = "Calculator",
|
|
||||||
ImageFileName = "Calculator.exe",
|
|
||||||
PackageFamilyName = "Microsoft.WindowsCalculator",
|
|
||||||
FirstView = "ms-resource:///Files/Views/MainPage.xbf"
|
|
||||||
};
|
|
||||||
#>
|
|
||||||
<?xml version='1.0' encoding='utf-8' standalone='yes'?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Based on:
|
|
||||||
\base\PerfTest\MemRe\AppLifecycle\Common\Regions\Regions_Calculator.xml Regions_Calculator.xml
|
|
||||||
|
|
||||||
This is a regions of interest file that can be used by WPA to get a quick overview of the time
|
|
||||||
spent on a set of operations called "regions".
|
|
||||||
|
|
||||||
A region is defined as the combination of a Start and a Stop event.
|
|
||||||
|
|
||||||
This file contains regions that are of interest for the startup of a UWP app.
|
|
||||||
The first region "<#= options.RegionPrefix #>_AppLifecycle" is defined by the Start and Stop event of the test.
|
|
||||||
Subsequent regions are defined as children of this region to make sure we are only tracking
|
|
||||||
events that occurred during the test.
|
|
||||||
|
|
||||||
The events that are defined as Start and Stop events must come from an event provider that is enabled for the
|
|
||||||
trace that is being analyzed. For WinPerf, that means that the WPR Profile must have these providers enabled.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<?Copyright (c) Microsoft Corporation. All rights reserved.?>
|
|
||||||
<InstrumentationManifest>
|
|
||||||
<Instrumentation>
|
|
||||||
<Regions>
|
|
||||||
<RegionRoot Guid="{7e8672b5-efe5-4862-90f3-944f136d6c75}"
|
|
||||||
Name="<#= options.RegionPrefix #>_AppLifeCycle Region Root"
|
|
||||||
FriendlyName="Root">
|
|
||||||
<Region Guid="{cf6c4996-1dc8-4fc5-b275-7a7051376f77}"
|
|
||||||
Name="<#= options.RegionPrefix #>_AppLifeCycle"
|
|
||||||
FriendlyName="Application Life Cycle Test">
|
|
||||||
<Start>
|
|
||||||
<!-- Microsoft-Windows-TestExecution\RunTest_TestRunScope\win:Start -->
|
|
||||||
<Event Provider="{70d27130-f2f3-4365-b790-d31223254ef4}" Name="RunTest_TestRunScope" Opcode="1"/>
|
|
||||||
<!-- Match the name of the test we are running. -->
|
|
||||||
<PayloadIdentifier FieldName="Name" FieldValue="Calculator.PerfTests.AppLifecycleTests.*" FieldValueRelationship="RegEx"/>
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Microsoft-Windows-TestExecution\RunTest_TestRunScope\win:Stop -->
|
|
||||||
<Event Provider="{70d27130-f2f3-4365-b790-d31223254ef4}" Name="RunTest_TestRunScope" Opcode="2"/>
|
|
||||||
<!-- Match the name of the test we are running. -->
|
|
||||||
<PayloadIdentifier FieldName="Name" FieldValue="Calculator.PerfTests.AppLifecycleTests.*" FieldValueRelationship="RegEx"/>
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PayloadBased NameField="Name"/>
|
|
||||||
</Naming>
|
|
||||||
<Region Guid="{b18b32ec-6796-43e1-802f-aec9aea5eb28}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_ProcessStart"
|
|
||||||
FriendlyName="Process Started">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="<#= options.PackageFamilyName #>.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<Event Provider="{2839ff94-8f12-4e1b-82e3-af7af77a450f}" Name="ProcessStarted" Version="0" />
|
|
||||||
<PayloadIdentifier FieldName="ImageFileName" FieldValue=".*<#= options.ImageFileName #>" FieldValueRelationship="RegEx" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{b1e4255d-131c-4ea8-899d-30b7345bf7d3}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_UIThreadStart"
|
|
||||||
FriendlyName="UI Thread Started">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="<#= options.PackageFamilyName #>.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Ideally use actual thread start event, for now it's just close, using InitializeCore -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="31" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{38084b96-d955-4603-a2c7-2720195ce160}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_InitializeCore"
|
|
||||||
FriendlyName="Create XAML Core">
|
|
||||||
<Start>
|
|
||||||
<!-- Initialize Core Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="31" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Initialize Core Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="32" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{cc909ec4-17c0-4cd9-9a83-293e06e0dc72}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_CreateDevice"
|
|
||||||
FriendlyName="Create Graphics Device">
|
|
||||||
<Start>
|
|
||||||
<!-- Create Device Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="76" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Create Device Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="77" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{0ed49a01-2604-499e-8003-0878b3b3c61e}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_CreateResourceManager"
|
|
||||||
FriendlyName="Create Resource Manager">
|
|
||||||
<Start>
|
|
||||||
<!-- Create Resource Manager Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="463" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Create Resource Manager Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="464" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{365920df-10e7-4b6e-8dcb-e769844ac11f}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_CreateWindow"
|
|
||||||
FriendlyName="Create Window">
|
|
||||||
<Start>
|
|
||||||
<!-- Create Window Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="29" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Create Window Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="30" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{09995446-0266-4a34-aa39-d99467dfe85d}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_InitializeTheme"
|
|
||||||
FriendlyName="Initialize Theme Resources">
|
|
||||||
<Start>
|
|
||||||
<!-- Theme Changed Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="457" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Theme Changed Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="458" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{a2fdff0b-75c8-440d-bb55-b87a3c60d55f}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_NavToFirstFrame"
|
|
||||||
FriendlyName="XAML Navigate To First Frame Drawn">
|
|
||||||
<Start>
|
|
||||||
<!-- Parse XAML -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="1" Version="0" />
|
|
||||||
<PayloadIdentifier FieldName="URI" FieldValue="<#= options.FirstView #>" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Frame Drawn -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="65" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
<Match>
|
|
||||||
<Event PID="true"/>
|
|
||||||
</Match>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{ffc47f79-2d90-470a-bfde-0d075972f23b}"
|
|
||||||
Name="<#= options.RegionPrefix #>_ApplicationActivate"
|
|
||||||
FriendlyName="Application Activate">
|
|
||||||
<Start>
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="5901" Version="1" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="5902" Version="1" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{b0c74cf1-16fc-4a33-ba7e-2169727a08d7}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_SplashScreen"
|
|
||||||
FriendlyName="Splash Screen Dismissed">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="<#= options.PackageFamilyName #>.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- NavigationServerTask_SplashScreenDismissed -->
|
|
||||||
<Event Provider="{a0b7550f-4e9a-4f03-ad41-b8042d06a2f7}" Id="1572" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{a1648637-d5ec-46d2-9655-a26d00a35764}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_UIResponsive"
|
|
||||||
FriendlyName="UI Responsive">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="<#= options.PackageFamilyName #>.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<Event Provider="{EF00584A-2655-462C-BC24-E7DE630E7FBF}" Name="ModernAppLaunch_UIResponsive" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{74d63c4e-7dd7-4ff6-9ee8-adb462c1c101}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Launch_VisibleComplete"
|
|
||||||
FriendlyName="Visible Complete">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="<#= options.PackageFamilyName #>.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<Event Provider="{EF00584A-2655-462C-BC24-E7DE630E7FBF}" Name="ModernAppLaunch_VisibleComplete" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{ec31fb10-992b-438b-8c9e-42454f4b2e5a}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Suspend"
|
|
||||||
FriendlyName="Suspended">
|
|
||||||
<Start>
|
|
||||||
<!-- Microsoft-Windows-Immersive-Shell\PerfTrack_PLM_SuspendApplication\win:Start -->
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="2450" Version="1" />
|
|
||||||
<PayloadIdentifier FieldName="PsmKey" FieldValueRelationship="RegEx" FieldValue="<#= options.PackageFamilyName #>.*" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Microsoft-Windows-Immersive-Shell\PerfTrack_PLM_SuspendApplication\win:Stop -->
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="2451" Version="1" />
|
|
||||||
<PayloadIdentifier FieldName="AppUserModelId" FieldValue="<#= options.PackageFamilyName #>.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{83735b08-b17e-48cf-82f1-02cb08e45597}"
|
|
||||||
Name="<#= options.RegionPrefix #>_Resume"
|
|
||||||
FriendlyName="Resumed">
|
|
||||||
<Start>
|
|
||||||
<!-- Microsoft-Windows-Immersive-Shell\PerfTrack_PLM_ResumeApplication_EndToEnd\win:Start -->
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="11118" Version="0" />
|
|
||||||
<PayloadIdentifier FieldName="PsmKey" FieldValueRelationship="RegEx" FieldValue="<#= options.PackageFamilyName #>.*" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Microsoft-Windows-Immersive-Shell\PerfTrack_PLM_ResumeApplication_EndToEnd\win:Stop -->
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="11119" Version="0" />
|
|
||||||
<PayloadIdentifier FieldName="AppUserModelId" FieldValue="<#= options.PackageFamilyName #>.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName><#= options.ImageFileName #></WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
</Region>
|
|
||||||
</RegionRoot>
|
|
||||||
</Regions>
|
|
||||||
</Instrumentation>
|
|
||||||
</InstrumentationManifest>
|
|
@ -1,353 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8' standalone='yes'?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Based on:
|
|
||||||
\base\PerfTest\MemRe\AppLifecycle\Common\Regions\Regions_Calculator.xml Regions_Calculator.xml
|
|
||||||
|
|
||||||
This is a regions of interest file that can be used by WPA to get a quick overview of the time
|
|
||||||
spent on a set of operations called "regions".
|
|
||||||
|
|
||||||
A region is defined as the combination of a Start and a Stop event.
|
|
||||||
|
|
||||||
This file contains regions that are of interest for the startup of a UWP app.
|
|
||||||
The first region "Calculator_AppLifecycle" is defined by the Start and Stop event of the test.
|
|
||||||
Subsequent regions are defined as children of this region to make sure we are only tracking
|
|
||||||
events that occurred during the test.
|
|
||||||
|
|
||||||
The events that are defined as Start and Stop events must come from an event provider that is enabled for the
|
|
||||||
trace that is being analyzed. For WinPerf, that means that the WPR Profile must have these providers enabled.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<?Copyright (c) Microsoft Corporation. All rights reserved.?>
|
|
||||||
<InstrumentationManifest>
|
|
||||||
<Instrumentation>
|
|
||||||
<Regions>
|
|
||||||
<RegionRoot Guid="{7e8672b5-efe5-4862-90f3-944f136d6c75}"
|
|
||||||
Name="Calculator_AppLifeCycle Region Root"
|
|
||||||
FriendlyName="Root">
|
|
||||||
<Region Guid="{cf6c4996-1dc8-4fc5-b275-7a7051376f77}"
|
|
||||||
Name="Calculator_AppLifeCycle"
|
|
||||||
FriendlyName="Application Life Cycle Test">
|
|
||||||
<Start>
|
|
||||||
<!-- Microsoft-Windows-TestExecution\TE_TestRun\win:Start -->
|
|
||||||
<Event Provider="{065903c1-4883-4fb8-b163-d02bd5efc74c}" Id="7" Version="0" />
|
|
||||||
<!-- Match the name of the test we are running. -->
|
|
||||||
<PayloadIdentifier FieldName="Name" FieldValue="Calculator.PerfTests.AppLifecycleTests.*" FieldValueRelationship="RegEx"/>
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Microsoft-Windows-TestExecution\TE_TestRun\win:Stop -->
|
|
||||||
<Event Provider="{065903c1-4883-4fb8-b163-d02bd5efc74c}" Id="8" Version="0" />
|
|
||||||
<!-- Match the name of the test we are running. -->
|
|
||||||
<PayloadIdentifier FieldName="Name" FieldValue="Calculator.PerfTests.AppLifecycleTests.*" FieldValueRelationship="RegEx"/>
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PayloadBased NameField="Name"/>
|
|
||||||
</Naming>
|
|
||||||
<Region Guid="{b18b32ec-6796-43e1-802f-aec9aea5eb28}"
|
|
||||||
Name="Calculator_Launch_ProcessStart"
|
|
||||||
FriendlyName="Process Started">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="Microsoft.WindowsCalculator.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<Event Provider="{2839ff94-8f12-4e1b-82e3-af7af77a450f}" Name="ProcessStarted" Version="0" />
|
|
||||||
<PayloadIdentifier FieldName="ImageFileName" FieldValue=".*Calculator.exe" FieldValueRelationship="RegEx" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{b1e4255d-131c-4ea8-899d-30b7345bf7d3}"
|
|
||||||
Name="Calculator_Launch_UIThreadStart"
|
|
||||||
FriendlyName="UI Thread Started">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="Microsoft.WindowsCalculator.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Ideally use actual thread start event, for now it's just close, using InitializeCore -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="31" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{38084b96-d955-4603-a2c7-2720195ce160}"
|
|
||||||
Name="Calculator_Launch_InitializeCore"
|
|
||||||
FriendlyName="Create XAML Core">
|
|
||||||
<Start>
|
|
||||||
<!-- Initialize Core Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="31" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Initialize Core Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="32" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{cc909ec4-17c0-4cd9-9a83-293e06e0dc72}"
|
|
||||||
Name="Calculator_Launch_CreateDevice"
|
|
||||||
FriendlyName="Create Graphics Device">
|
|
||||||
<Start>
|
|
||||||
<!-- Create Device Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="76" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Create Device Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="77" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{0ed49a01-2604-499e-8003-0878b3b3c61e}"
|
|
||||||
Name="Calculator_Launch_CreateResourceManager"
|
|
||||||
FriendlyName="Create Resource Manager">
|
|
||||||
<Start>
|
|
||||||
<!-- Create Resource Manager Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="463" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Create Resource Manager Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="464" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{365920df-10e7-4b6e-8dcb-e769844ac11f}"
|
|
||||||
Name="Calculator_Launch_CreateWindow"
|
|
||||||
FriendlyName="Create Window">
|
|
||||||
<Start>
|
|
||||||
<!-- Create Window Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="29" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Create Window Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="30" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{09995446-0266-4a34-aa39-d99467dfe85d}"
|
|
||||||
Name="Calculator_Launch_InitializeTheme"
|
|
||||||
FriendlyName="Initialize Theme Resources">
|
|
||||||
<Start>
|
|
||||||
<!-- Theme Changed Start -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="457" Version="0" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Theme Changed Stop -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="458" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{a2fdff0b-75c8-440d-bb55-b87a3c60d55f}"
|
|
||||||
Name="Calculator_Launch_NavToFirstFrame"
|
|
||||||
FriendlyName="XAML Navigate To First Frame Drawn">
|
|
||||||
<Start>
|
|
||||||
<!-- Parse XAML -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="1" Version="0" />
|
|
||||||
<PayloadIdentifier FieldName="URI" FieldValue="ms-resource:///Files/Views/MainPage.xbf" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Frame Drawn -->
|
|
||||||
<Event Provider="{531A35AB-63CE-4BCF-AA98-F88C7A89E455}" Id="65" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
<Match>
|
|
||||||
<Event PID="true"/>
|
|
||||||
</Match>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{ffc47f79-2d90-470a-bfde-0d075972f23b}"
|
|
||||||
Name="Calculator_ApplicationActivate"
|
|
||||||
FriendlyName="Application Activate">
|
|
||||||
<Start>
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="5901" Version="1" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="5902" Version="1" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{b0c74cf1-16fc-4a33-ba7e-2169727a08d7}"
|
|
||||||
Name="Calculator_Launch_SplashScreen"
|
|
||||||
FriendlyName="Splash Screen Dismissed">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="Microsoft.WindowsCalculator.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- NavigationServerTask_SplashScreenDismissed -->
|
|
||||||
<Event Provider="{a0b7550f-4e9a-4f03-ad41-b8042d06a2f7}" Id="1572" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{a1648637-d5ec-46d2-9655-a26d00a35764}"
|
|
||||||
Name="Calculator_Launch_UIResponsive"
|
|
||||||
FriendlyName="UI Responsive">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="Microsoft.WindowsCalculator.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<Event Provider="{EF00584A-2655-462C-BC24-E7DE630E7FBF}" Name="ModernAppLaunch_UIResponsive" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{74d63c4e-7dd7-4ff6-9ee8-adb462c1c101}"
|
|
||||||
Name="Calculator_Launch_VisibleComplete"
|
|
||||||
FriendlyName="Visible Complete">
|
|
||||||
<Start>
|
|
||||||
<!-- Use AAMShim_ActivationStart instead of AppLaunch_UserClick as we don't lanch from Start -->
|
|
||||||
<Event Provider="{cf7f94b3-08dc-5257-422f-497d7dc86ab3}" Name="AAMShim_ActivationStart" />
|
|
||||||
<PayloadIdentifier FieldName="AppId" FieldValue="Microsoft.WindowsCalculator.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<Event Provider="{EF00584A-2655-462C-BC24-E7DE630E7FBF}" Name="ModernAppLaunch_VisibleComplete" Version="0" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{ec31fb10-992b-438b-8c9e-42454f4b2e5a}"
|
|
||||||
Name="Calculator_Suspend"
|
|
||||||
FriendlyName="Suspended">
|
|
||||||
<Start>
|
|
||||||
<!-- Microsoft-Windows-Immersive-Shell\PerfTrack_PLM_SuspendApplication\win:Start -->
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="2450" Version="1" />
|
|
||||||
<PayloadIdentifier FieldName="PsmKey" FieldValueRelationship="RegEx" FieldValue="Microsoft.WindowsCalculator.*" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Microsoft-Windows-Immersive-Shell\PerfTrack_PLM_SuspendApplication\win:Stop -->
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="2451" Version="1" />
|
|
||||||
<PayloadIdentifier FieldName="AppUserModelId" FieldValue="Microsoft.WindowsCalculator.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
<Region Guid="{83735b08-b17e-48cf-82f1-02cb08e45597}"
|
|
||||||
Name="Calculator_Resume"
|
|
||||||
FriendlyName="Resumed">
|
|
||||||
<Start>
|
|
||||||
<!-- Microsoft-Windows-Immersive-Shell\PerfTrack_PLM_ResumeApplication_EndToEnd\win:Start -->
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="11118" Version="0" />
|
|
||||||
<PayloadIdentifier FieldName="PsmKey" FieldValueRelationship="RegEx" FieldValue="Microsoft.WindowsCalculator.*" />
|
|
||||||
</Start>
|
|
||||||
<Stop>
|
|
||||||
<!-- Microsoft-Windows-Immersive-Shell\PerfTrack_PLM_ResumeApplication_EndToEnd\win:Stop -->
|
|
||||||
<Event Provider="{315a8872-923e-4ea2-9889-33cd4754bf64}" Id="11119" Version="0" />
|
|
||||||
<PayloadIdentifier FieldName="AppUserModelId" FieldValue="Microsoft.WindowsCalculator.*" FieldValueRelationship="RegEx" />
|
|
||||||
</Stop>
|
|
||||||
<Naming>
|
|
||||||
<PrependParentName />
|
|
||||||
</Naming>
|
|
||||||
<Metadata>
|
|
||||||
<WinperfWPAPreset.1>CPU</WinperfWPAPreset.1>
|
|
||||||
<WinperfWPAPreset.1.ProcessName>Calculator.exe</WinperfWPAPreset.1.ProcessName>
|
|
||||||
<WinperfWPAPreset.2>Commit</WinperfWPAPreset.2>
|
|
||||||
<WinperfWPAPreset.2.ProcessName>Calculator.exe</WinperfWPAPreset.2.ProcessName>
|
|
||||||
</Metadata>
|
|
||||||
</Region>
|
|
||||||
</Region>
|
|
||||||
</RegionRoot>
|
|
||||||
</Regions>
|
|
||||||
</Instrumentation>
|
|
||||||
</InstrumentationManifest>
|
|
@ -1,54 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Calculator.UIAutomationLibrary;
|
|
||||||
using Microsoft.OneCoreUap.Test.AppModel;
|
|
||||||
using WEX.TestExecution;
|
|
||||||
using WEX.TestExecution.Markup;
|
|
||||||
|
|
||||||
namespace Calculator.UITests
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
public class Initialization
|
|
||||||
{
|
|
||||||
[DllImport("AppModel.TestHelper.dll")]
|
|
||||||
private static extern Int32 WinRTHelper_Register();
|
|
||||||
|
|
||||||
[AssemblyInitialize]
|
|
||||||
[TestProperty("CoreClrProfile", "TestNetv2.0")]
|
|
||||||
[TestProperty("RunFixtureAs:Assembly", "System")]
|
|
||||||
public static void AssemblySetup(TestContext context)
|
|
||||||
{
|
|
||||||
Verify.AreEqual(0, WinRTHelper_Register());
|
|
||||||
TestHelper.Initialize();
|
|
||||||
|
|
||||||
// Install and Start the Etw.Service service to enable the use of EtwWaiter.
|
|
||||||
EtwHelper.InstallAndStartETWService();
|
|
||||||
|
|
||||||
bool installApp = false;
|
|
||||||
if (context.Properties.Contains("InstallApp") && (bool.TryParse(context.Properties["InstallApp"].ToString(), out installApp)) && installApp)
|
|
||||||
{
|
|
||||||
string certToDeploy = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), Constants.CertificateFileName);
|
|
||||||
InstallHelper.InstallCertFile(certToDeploy);
|
|
||||||
|
|
||||||
string vcLibsToDeploy = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), Constants.VCLibsPackageFileName);
|
|
||||||
string winUIToDeploy = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), Constants.WinUIPackageFileName);
|
|
||||||
string appxToDeploy = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), Constants.PackageFileName);
|
|
||||||
Impersonater.RunAs(Impersonater.RunAsUser.RestrictedUser, () => InstallHelper.InstallPackage(appxToDeploy, vcLibsToDeploy, winUIToDeploy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[AssemblyCleanup]
|
|
||||||
[TestProperty("RunFixtureAs:Assembly", "System")]
|
|
||||||
public static void AssemblyCleanup()
|
|
||||||
{
|
|
||||||
// Stop and remove the Etw.Service service.
|
|
||||||
EtwHelper.StopAndRemoveETWService();
|
|
||||||
|
|
||||||
TestHelper.Uninitialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("UIAutomationTests")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("f5e8f9b8-f7f1-4300-a5cb-35bfab83f51e")]
|
|
||||||
// The following was autogenerated by UpdateVersion.ps1
|
|
||||||
[assembly: AssemblyProduct(@"10.16.1128.1252")]
|
|
@ -1,51 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using Etw.Managed;
|
|
||||||
using Microsoft.Windows.Apps.Performance;
|
|
||||||
using WEX.Logging.Interop;
|
|
||||||
using WEX.TestExecution;
|
|
||||||
using WEX.TestExecution.Markup;
|
|
||||||
using Calculator.UIAutomationLibrary;
|
|
||||||
|
|
||||||
namespace Calculator.PerfTests
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
public class AppLifecycleTests
|
|
||||||
{
|
|
||||||
[TestInitialize]
|
|
||||||
[TestProperty("RunAs", "ElevatedUserOrSystem")]
|
|
||||||
public void MethodSetup()
|
|
||||||
{
|
|
||||||
Utilities.KillExistingCalculatorProcesses();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCleanup]
|
|
||||||
[TestProperty("RunAs", "ElevatedUserOrSystem")]
|
|
||||||
public void MethodCleanup()
|
|
||||||
{
|
|
||||||
Utilities.KillExistingCalculatorProcesses();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This method executes the AppLifecycle performance test.
|
|
||||||
/// The test launches the application, suspend and resumes it and then terminates the app.
|
|
||||||
///
|
|
||||||
/// A TAEF data source is used to specify the Windows Performance Recorder profile and
|
|
||||||
/// regions of interest file to use and defines three different configurations to execute this test with.
|
|
||||||
/// Cold: The initial run to get dlls loaded into memory and to execute any first-run app logic.
|
|
||||||
/// Warm: The run that will produce consistent results and that would be used for measures.
|
|
||||||
/// Memory: A run that is focused on collecting more info on allocations.
|
|
||||||
/// </summary>
|
|
||||||
[TestMethod]
|
|
||||||
[TestProperty("RunAs", "User")]
|
|
||||||
[TestProperty("Category", "Performance")]
|
|
||||||
[TestProperty(WinperfConstants.DataSource, PerfConstants.AppLifecycleIterationsSource)]
|
|
||||||
public void AppLifecycleTest()
|
|
||||||
{
|
|
||||||
AppLifecycle.Run(Constants.PackageAppUserModelId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using Calculator.UIAutomationLibrary;
|
|
||||||
using Calculator.UIAutomationLibrary.Tests;
|
|
||||||
using WEX.TestExecution.Markup;
|
|
||||||
|
|
||||||
namespace Calculator.UITests
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
public class CalculatorTests
|
|
||||||
{
|
|
||||||
[TestInitialize]
|
|
||||||
[TestProperty("RunAs", "ElevatedUserOrSystem")]
|
|
||||||
public void MethodSetup()
|
|
||||||
{
|
|
||||||
Utilities.KillExistingCalculatorProcesses();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCleanup]
|
|
||||||
[TestProperty("RunAs", "ElevatedUserOrSystem")]
|
|
||||||
public void MethodCleanup()
|
|
||||||
{
|
|
||||||
Utilities.KillExistingCalculatorProcesses();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[TestProperty("RunAs", "User")]
|
|
||||||
public void OnePlusTwoTest()
|
|
||||||
{
|
|
||||||
var calculatorLfm = CalculatorAppLauncher.Launch();
|
|
||||||
|
|
||||||
calculatorLfm.CalculateOnePlusTwo();
|
|
||||||
|
|
||||||
calculatorLfm.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[TestProperty("RunAs", "User")]
|
|
||||||
public void Sqrt4Minus2Test()
|
|
||||||
{
|
|
||||||
var calculatorLfm = CalculatorAppLauncher.Launch();
|
|
||||||
|
|
||||||
calculatorLfm.CalculateSqrt4Minus2();
|
|
||||||
|
|
||||||
calculatorLfm.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using MS.Internal.Mita.Foundation;
|
|
||||||
using MS.Internal.Mita.Foundation.Controls;
|
|
||||||
using MS.Internal.Mita.Foundation.Waiters;
|
|
||||||
using System;
|
|
||||||
using WEX.TestExecution;
|
|
||||||
using WEX.TestExecution.Markup;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Microsoft.OneCoreUap.Test.AppModel;
|
|
||||||
using System.IO;
|
|
||||||
using Calculator.UITests;
|
|
||||||
using Calculator.UIAutomationLibrary;
|
|
||||||
|
|
||||||
namespace Calculator.UITests
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
public class LaunchTests
|
|
||||||
{
|
|
||||||
[TestInitialize]
|
|
||||||
[TestProperty("RunAs", "ElevatedUserOrSystem")]
|
|
||||||
public void MethodSetup()
|
|
||||||
{
|
|
||||||
Utilities.KillExistingCalculatorProcesses();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCleanup]
|
|
||||||
[TestProperty("RunAs", "ElevatedUserOrSystem")]
|
|
||||||
public void MethodCleanup()
|
|
||||||
{
|
|
||||||
Utilities.KillExistingCalculatorProcesses();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[TestProperty("RunAs", "User")]
|
|
||||||
public void NormalLaunchTest()
|
|
||||||
{
|
|
||||||
var calculatorLfm = CalculatorAppLauncher.Launch();
|
|
||||||
calculatorLfm.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"AppModel.TestHelper": "2018.3.22",
|
|
||||||
"EtwProcessor.Managed": "10.34.181220007",
|
|
||||||
"Microsoft.TestInfrastructure.UniversalTest": "1.0.20181107.1",
|
|
||||||
"Microsoft.Windows.Apps.Performance": "1.0.7",
|
|
||||||
"MITALite": "1.0.180128001",
|
|
||||||
"Taef.Managed": "10.34.181220007",
|
|
||||||
"Test.Net.Redist": "2.0.1"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"netcore50": {}
|
|
||||||
},
|
|
||||||
"runtimes": {
|
|
||||||
"win10-arm": {},
|
|
||||||
"win10-x64": {},
|
|
||||||
"win10-x86": {}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://universaltest/schema/testmddefinition-4.json",
|
|
||||||
"Package": {
|
|
||||||
"ComponentName": "Calculator",
|
|
||||||
"SubComponentName": "UITests"
|
|
||||||
},
|
|
||||||
"SupportedArchitectures": [ "All" ],
|
|
||||||
"Execution": {
|
|
||||||
"Type": "TAEF",
|
|
||||||
"Parameter": "/ScreenCaptureOnError /TestMode:EnsureLoggedOnUser",
|
|
||||||
"ExecutionTimeoutInMinutes": "30"
|
|
||||||
},
|
|
||||||
"Dependencies": {
|
|
||||||
"Files": [
|
|
||||||
{
|
|
||||||
"SourcePath": "$(OUT_DIR)Calculator.UIAutomationLibrary.dll",
|
|
||||||
"DestinationFolderPath": "$$(TEST_DEPLOY_BIN)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SourcePath": "$(OUT_DIR)Microsoft.Windows.Apps.Performance.dll",
|
|
||||||
"DestinationFolderPath": "$$(TEST_DEPLOY_BIN)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SourcePath": "$(OUT_DIR)Config\\AppLifecycle.Profile.wprp",
|
|
||||||
"DestinationFolderPath": "$$(TEST_DEPLOY_BIN)\\Config\\"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SourcePath": "$(OUT_DIR)Config\\AppLifecycle.Regions.xml",
|
|
||||||
"DestinationFolderPath": "$$(TEST_DEPLOY_BIN)\\Config\\"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"SourcePath": "$(OUT_DIR)Config\\AppLifecycle.Iterations.xml",
|
|
||||||
"DestinationFolderPath": "$$(TEST_DEPLOY_BIN)\\Config\\"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Packages": [
|
|
||||||
"Microsoft-Windows-Test-Taef",
|
|
||||||
"Microsoft-Windows-Test-EtwProcessor",
|
|
||||||
"Microsoft-Test-Taef-EnsureLoggedOnUserTestMode",
|
|
||||||
"Microsoft-Test-Taef-EtwLoggerTestMode",
|
|
||||||
"Microsoft-Windows-Test-MitaLite",
|
|
||||||
"Microsoft-Windows-Test-TestNetV2.0",
|
|
||||||
"Microsoft-OneCoreUap-Test-AppModel-AreaLibrary"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Logs": [],
|
|
||||||
"Plugins": [],
|
|
||||||
"Profiles": [
|
|
||||||
{
|
|
||||||
"Name": "All",
|
|
||||||
"Execution": {
|
|
||||||
"AdditionalParameter": "/TestMode:EtwLogger /p:InstallApp=true /select:not(@Category='Performance')"
|
|
||||||
},
|
|
||||||
"Dependencies": {
|
|
||||||
"AdditionalPackages": [
|
|
||||||
"Microsoft-Calculator-App"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Performance",
|
|
||||||
"Execution": {
|
|
||||||
"AdditionalParameter": "/TestMode:WinPerf /WinPerf:Upload=Full /winperf:WinPerfSource=\"Utility Apps Performance Tests\" /winperf:VersionProcess=Calculator.exe /winperf:VersionImage=Calculator.exe /p:InstallApp=true /select:@Category='Performance'"
|
|
||||||
},
|
|
||||||
"Dependencies": {
|
|
||||||
"AdditionalPackages": [
|
|
||||||
"Microsoft-Windows-Performance-Winperf-Winperf",
|
|
||||||
"Microsoft-Calculator-App"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 15
|
|
||||||
VisualStudioVersion = 15.0.27130.2036
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator.UIAutomationLibrary", "Calculator.UIAutomationLibrary\Calculator.UIAutomationLibrary.csproj", "{A43517B5-8BE3-4312-913F-004978C34444}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator.UITests", "Calculator.UITests\Calculator.UITests.csproj", "{0224A709-0C48-4C4F-BA17-843A49842C15}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E73C8A6E-BB94-4258-ACED-7C837A6A587B}"
|
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
nuget.config = nuget.config
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator.TestPackage", "Calculator.TestPackage\Calculator.TestPackage.csproj", "{24767C43-CD5A-4DC9-8D6B-429F255524E5}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|ARM = Debug|ARM
|
|
||||||
Debug|ARM64 = Debug|ARM64
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|ARM = Release|ARM
|
|
||||||
Release|ARM64 = Release|ARM64
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Debug|ARM.Build.0 = Debug|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Release|ARM.ActiveCfg = Release|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Release|ARM.Build.0 = Release|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Release|ARM64.ActiveCfg = Release|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{A43517B5-8BE3-4312-913F-004978C34444}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|ARM.ActiveCfg = Debug|ARM
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|ARM.Build.0 = Debug|ARM
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|x86.ActiveCfg = Debug|x86
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|x86.Build.0 = Debug|x86
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Release|ARM.ActiveCfg = Release|ARM
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Release|ARM.Build.0 = Release|ARM
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Release|ARM64.ActiveCfg = Release|ARM64
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Release|x64.Build.0 = Release|x64
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Release|x86.ActiveCfg = Release|x86
|
|
||||||
{0224A709-0C48-4C4F-BA17-843A49842C15}.Release|x86.Build.0 = Release|x86
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|ARM.ActiveCfg = Debug|ARM
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|ARM.Build.0 = Debug|ARM
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|x86.ActiveCfg = Debug|x86
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|x86.Build.0 = Debug|x86
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|ARM.ActiveCfg = Release|ARM
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|ARM.Build.0 = Release|ARM
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|ARM64.ActiveCfg = Release|ARM64
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|x64.Build.0 = Release|x64
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|x86.ActiveCfg = Release|x86
|
|
||||||
{24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|x86.Build.0 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {97D9888A-CF9F-4147-8CCE-71093C057452}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -1 +0,0 @@
|
|||||||
This directory contains projects that have dependencies on internal Microsoft tools and that are not necessary to build Calculator.
|
|
@ -1,39 +0,0 @@
|
|||||||
{
|
|
||||||
"AttributesTolerance": 2,
|
|
||||||
"KeepFirstAttributeOnSameLine": true,
|
|
||||||
"MaxAttributeCharatersPerLine": 0,
|
|
||||||
"MaxAttributesPerLine": 1,
|
|
||||||
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransfom, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
|
|
||||||
"SeparateByGroups": false,
|
|
||||||
"EnableAttributeReordering": true,
|
|
||||||
"AttributeOrderingRuleGroups": [
|
|
||||||
"x:Class*",
|
|
||||||
"xmlns, xmlns:x",
|
|
||||||
"xmlns:*",
|
|
||||||
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
|
|
||||||
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
|
|
||||||
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
|
|
||||||
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
|
|
||||||
"Style, Background, Foreground, Fill, BorderBrush, BorderThickness, Stroke, StrokeThickness, Opacity",
|
|
||||||
"FontFamily, FontSize, LineHeight, FontWeight, FontStyle, FontStretch",
|
|
||||||
"*:*, *",
|
|
||||||
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
|
|
||||||
"mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText"
|
|
||||||
],
|
|
||||||
"OrderAttributesByName": true,
|
|
||||||
"PutEndingBracketOnNewLine": false,
|
|
||||||
"RemoveEndingTagOfEmptyElement": true,
|
|
||||||
"SpaceBeforeClosingSlash": false,
|
|
||||||
"RootElementLineBreakRule": 0,
|
|
||||||
"ReorderVSM": 1,
|
|
||||||
"ReorderGridChildren": false,
|
|
||||||
"ReorderCanvasChildren": false,
|
|
||||||
"ReorderSetters": 0,
|
|
||||||
"FormatMarkupExtension": true,
|
|
||||||
"NoNewLineMarkupExtensions": "x:Bind, Binding",
|
|
||||||
"ThicknessSeparator": 2,
|
|
||||||
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
|
|
||||||
"FormatOnSave": true,
|
|
||||||
"CommentPadding": 1,
|
|
||||||
"IndentSize": 4
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<solution>
|
|
||||||
<add key="disableSourceControlIntegration" value="true" />
|
|
||||||
</solution>
|
|
||||||
<packageSources>
|
|
||||||
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
|
|
||||||
<add key="MitaLite" value="https://microsoft.pkgs.visualstudio.com/DefaultCollection/_packaging/MitaLite/nuget/v3/index.json" />
|
|
||||||
<add key="Taef" value="https://microsoft.pkgs.visualstudio.com/DefaultCollection/_packaging/Taef/nuget/v3/index.json" />
|
|
||||||
<add key="Test.Net" value="https://microsoft.pkgs.visualstudio.com/DefaultCollection/_packaging/Test.Net/nuget/v3/index.json" />
|
|
||||||
<add key="AppModel.TestHelper" value="https://microsoft.pkgs.visualstudio.com/_packaging/AppModel.TestHelper/nuget/v3/index.json" />
|
|
||||||
<add key="WindowsApps" value="https://microsoft.pkgs.visualstudio.com/_packaging/WindowsApps/nuget/v3/index.json" />
|
|
||||||
<add key="WindowsES-External" value="https://microsoft.pkgs.visualstudio.com/_packaging/WindowsES-External/nuget/v3/index.json" />
|
|
||||||
<add key="EEApps" value="https://eeapps.blob.core.windows.net/eeapps/index.json" />
|
|
||||||
</packageSources>
|
|
||||||
<config>
|
|
||||||
<add key="dependencyversion" value="Highest" />
|
|
||||||
</config>
|
|
||||||
</configuration>
|
|
11
src/CMakeLists.txt
Normal file
11
src/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
project(calculator CXX)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER MATCHES ".*clang")
|
||||||
|
# Clang disagress with libstdc++ about constexpr-ness of wstring_view
|
||||||
|
# See https://github.com/Microsoft/calculator/pull/321
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(CalcManager)
|
14
src/CalcManager/CEngine/CMakeLists.txt
Normal file
14
src/CalcManager/CEngine/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
target_sources(CalcManager PRIVATE
|
||||||
|
calc.cpp
|
||||||
|
CalcInput.cpp
|
||||||
|
CalcUtils.cpp
|
||||||
|
History.cpp
|
||||||
|
Number.cpp
|
||||||
|
Rational.cpp
|
||||||
|
RationalMath.cpp
|
||||||
|
scicomm.cpp
|
||||||
|
scidisp.cpp
|
||||||
|
scifunc.cpp
|
||||||
|
scioper.cpp
|
||||||
|
sciset.cpp
|
||||||
|
)
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
#include <sstream>
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -124,7 +124,7 @@ bool CalcInput::TryAddDigit(unsigned int value, uint32_t radix, bool isIntegerMo
|
|||||||
else if (radix == 10)
|
else if (radix == 10)
|
||||||
{
|
{
|
||||||
// If value length is at least the max, we know we can't add another digit.
|
// If value length is at least the max, we know we can't add another digit.
|
||||||
if(pNumSec->value.size() < maxNumStr.size())
|
if (pNumSec->value.size() < maxNumStr.size())
|
||||||
{
|
{
|
||||||
// Compare value to substring of maxNumStr of value.size() length.
|
// Compare value to substring of maxNumStr of value.size() length.
|
||||||
// If cmpResult > 0:
|
// If cmpResult > 0:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
#include "Header Files/CalcUtils.h"
|
#include "Header Files/CalcUtils.h"
|
||||||
|
|
||||||
@ -34,9 +33,7 @@ bool IsDigitOpCode(OpCode opCode)
|
|||||||
// was never inout, we need to revert the state changes made as a result of this test
|
// was never inout, we need to revert the state changes made as a result of this test
|
||||||
bool IsGuiSettingOpCode(OpCode opCode)
|
bool IsGuiSettingOpCode(OpCode opCode)
|
||||||
{
|
{
|
||||||
if (IsOpInRange(opCode, IDM_HEX, IDM_BIN) ||
|
if (IsOpInRange(opCode, IDM_HEX, IDM_BIN) || IsOpInRange(opCode, IDM_QWORD, IDM_BYTE) || IsOpInRange(opCode, IDM_DEG, IDM_GRAD))
|
||||||
IsOpInRange(opCode, IDM_QWORD, IDM_BYTE) ||
|
|
||||||
IsOpInRange(opCode, IDM_DEG, IDM_GRAD))
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
#include "CalculatorVector.h"
|
#include "CalculatorVector.h"
|
||||||
@ -12,7 +11,8 @@ constexpr int ASCII_0 = 48;
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CalcEngine;
|
using namespace CalcEngine;
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
void IFT(ResultCode hr)
|
void IFT(ResultCode hr)
|
||||||
{
|
{
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
@ -39,11 +39,11 @@ void CHistoryCollector::ReinitHistory()
|
|||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
// Can throw Out of memory error
|
// Can throw Out of memory error
|
||||||
CHistoryCollector::CHistoryCollector(ICalcDisplay *pCalcDisplay, std::shared_ptr<IHistoryDisplay> pHistoryDisplay, wchar_t decimalSymbol) :
|
CHistoryCollector::CHistoryCollector(ICalcDisplay* pCalcDisplay, std::shared_ptr<IHistoryDisplay> pHistoryDisplay, wchar_t decimalSymbol)
|
||||||
m_pHistoryDisplay(pHistoryDisplay),
|
: m_pHistoryDisplay(pHistoryDisplay)
|
||||||
m_pCalcDisplay(pCalcDisplay),
|
, m_pCalcDisplay(pCalcDisplay)
|
||||||
m_iCurLineHistStart(-1),
|
, m_iCurLineHistStart(-1)
|
||||||
m_decimalSymbol(decimalSymbol)
|
, m_decimalSymbol(decimalSymbol)
|
||||||
{
|
{
|
||||||
ReinitHistory();
|
ReinitHistory();
|
||||||
}
|
}
|
||||||
@ -303,7 +303,8 @@ void CHistoryCollector::CompleteHistoryLine(wstring_view numStr)
|
|||||||
{
|
{
|
||||||
if (nullptr != m_pCalcDisplay)
|
if (nullptr != m_pCalcDisplay)
|
||||||
{
|
{
|
||||||
m_pCalcDisplay->SetExpressionDisplay(std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(), std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
|
m_pCalcDisplay->SetExpressionDisplay(
|
||||||
|
std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(), std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != m_pHistoryDisplay)
|
if (nullptr != m_pHistoryDisplay)
|
||||||
@ -324,14 +325,14 @@ void CHistoryCollector::ClearHistoryLine(wstring_view errStr)
|
|||||||
{
|
{
|
||||||
if (nullptr != m_pCalcDisplay)
|
if (nullptr != m_pCalcDisplay)
|
||||||
{
|
{
|
||||||
m_pCalcDisplay->SetExpressionDisplay(std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(), std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
|
m_pCalcDisplay->SetExpressionDisplay(
|
||||||
|
std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(), std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
|
||||||
}
|
}
|
||||||
m_iCurLineHistStart = -1; // It will get recomputed at the first Opnd
|
m_iCurLineHistStart = -1; // It will get recomputed at the first Opnd
|
||||||
ReinitHistory();
|
ReinitHistory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Adds the given string psz to the globally maintained current equation string at the end.
|
// Adds the given string psz to the globally maintained current equation string at the end.
|
||||||
// Also returns the 0 based index in the string just added. Can throw out of memory error
|
// Also returns the 0 based index in the string just added. Can throw out of memory error
|
||||||
int CHistoryCollector::IchAddSzToEquationSz(wstring_view str, int icommandIndex)
|
int CHistoryCollector::IchAddSzToEquationSz(wstring_view str, int icommandIndex)
|
||||||
@ -393,14 +394,13 @@ void CHistoryCollector::SetExpressionDisplay()
|
|||||||
{
|
{
|
||||||
m_pCalcDisplay->SetExpressionDisplay(m_spTokens, m_spCommands);
|
m_pCalcDisplay->SetExpressionDisplay(m_spTokens, m_spCommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CHistoryCollector::AddCommand(_In_ const std::shared_ptr<IExpressionCommand> & spCommand)
|
int CHistoryCollector::AddCommand(_In_ const std::shared_ptr<IExpressionCommand>& spCommand)
|
||||||
{
|
{
|
||||||
if (m_spCommands == nullptr)
|
if (m_spCommands == nullptr)
|
||||||
{
|
{
|
||||||
m_spCommands = std::make_shared <CalculatorVector<std::shared_ptr<IExpressionCommand>>>();
|
m_spCommands = std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(m_spCommands->Append(spCommand)))
|
if (FAILED(m_spCommands->Append(spCommand)))
|
||||||
|
@ -1,26 +1,28 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
#include "pch.h"
|
#include <algorithm>
|
||||||
#include "Header Files/Number.h"
|
#include "Header Files/Number.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace CalcEngine
|
namespace CalcEngine
|
||||||
{
|
{
|
||||||
Number::Number() noexcept :
|
Number::Number() noexcept
|
||||||
Number(1, 0, { 0 })
|
: Number(1, 0, { 0 })
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Number::Number(int32_t sign, int32_t exp, vector<uint32_t> const& mantissa) noexcept :
|
Number::Number(int32_t sign, int32_t exp, vector<uint32_t> const& mantissa) noexcept
|
||||||
m_sign{ sign },
|
: m_sign{ sign }
|
||||||
m_exp{ exp },
|
, m_exp{ exp }
|
||||||
m_mantissa{ mantissa }
|
, m_mantissa{ mantissa }
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Number::Number(PNUMBER p) noexcept :
|
Number::Number(PNUMBER p) noexcept
|
||||||
m_sign{ p->sign },
|
: m_sign{ p->sign }
|
||||||
m_exp{ p->exp },
|
, m_exp{ p->exp }
|
||||||
m_mantissa{}
|
, m_mantissa{}
|
||||||
{
|
{
|
||||||
m_mantissa.reserve(p->cdigit);
|
m_mantissa.reserve(p->cdigit);
|
||||||
copy(p->mant, p->mant + p->cdigit, back_inserter(m_mantissa));
|
copy(p->mant, p->mant + p->cdigit, back_inserter(m_mantissa));
|
||||||
@ -33,7 +35,7 @@ namespace CalcEngine
|
|||||||
ret->exp = this->Exp();
|
ret->exp = this->Exp();
|
||||||
ret->cdigit = static_cast<int32_t>(this->Mantissa().size());
|
ret->cdigit = static_cast<int32_t>(this->Mantissa().size());
|
||||||
|
|
||||||
MANTTYPE *ptrRet = ret->mant;
|
MANTTYPE* ptrRet = ret->mant;
|
||||||
for (auto const& digit : this->Mantissa())
|
for (auto const& digit : this->Mantissa())
|
||||||
{
|
{
|
||||||
*ptrRet++ = digit;
|
*ptrRet++ = digit;
|
||||||
@ -59,6 +61,6 @@ namespace CalcEngine
|
|||||||
|
|
||||||
bool Number::IsZero() const
|
bool Number::IsZero() const
|
||||||
{
|
{
|
||||||
return all_of(m_mantissa.begin(), m_mantissa.end(), [](auto &&i) { return i == 0; });
|
return all_of(m_mantissa.begin(), m_mantissa.end(), [](auto&& i) { return i == 0; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "Header Files/Rational.h"
|
#include "Header Files/Rational.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace CalcEngine
|
namespace CalcEngine
|
||||||
{
|
{
|
||||||
Rational::Rational() noexcept :
|
Rational::Rational() noexcept
|
||||||
m_p{},
|
: m_p{}
|
||||||
m_q{ 1, 0, { 1 } }
|
, m_q{ 1, 0, { 1 } }
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Rational::Rational(Number const& n) noexcept
|
Rational::Rational(Number const& n) noexcept
|
||||||
{
|
{
|
||||||
@ -24,10 +24,11 @@ namespace CalcEngine
|
|||||||
m_q = Number(1, qExp, { 1 });
|
m_q = Number(1, qExp, { 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
Rational::Rational(Number const& p, Number const& q) noexcept :
|
Rational::Rational(Number const& p, Number const& q) noexcept
|
||||||
m_p{ p },
|
: m_p{ p }
|
||||||
m_q{ q }
|
, m_q{ q }
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Rational::Rational(int32_t i)
|
Rational::Rational(int32_t i)
|
||||||
{
|
{
|
||||||
@ -51,8 +52,8 @@ namespace CalcEngine
|
|||||||
|
|
||||||
Rational::Rational(uint64_t ui)
|
Rational::Rational(uint64_t ui)
|
||||||
{
|
{
|
||||||
uint32_t hi = HIDWORD(ui);
|
uint32_t hi = (uint32_t) (((ui) >> 32) & 0xffffffff);
|
||||||
uint32_t lo = LODWORD(ui);
|
uint32_t lo = (uint32_t) ui;
|
||||||
|
|
||||||
Rational temp = (Rational{ hi } << 32) | lo;
|
Rational temp = (Rational{ hi } << 32) | lo;
|
||||||
|
|
||||||
@ -60,10 +61,11 @@ namespace CalcEngine
|
|||||||
m_q = Number{ temp.Q() };
|
m_q = Number{ temp.Q() };
|
||||||
}
|
}
|
||||||
|
|
||||||
Rational::Rational(PRAT prat) noexcept :
|
Rational::Rational(PRAT prat) noexcept
|
||||||
m_p{ Number{prat->pp} },
|
: m_p{ Number{ prat->pp } }
|
||||||
m_q{ Number{prat->pq} }
|
, m_q{ Number{ prat->pq } }
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
PRAT Rational::ToPRAT() const
|
PRAT Rational::ToPRAT() const
|
||||||
{
|
{
|
||||||
@ -182,6 +184,13 @@ namespace CalcEngine
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate the remainder after division, the sign of a result will match the sign of the current object.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This function has the same behavior as the standard C/C++ operator '%'
|
||||||
|
/// to calculate the modulus after division instead, use <see cref="RationalMath::Mod"/> instead.
|
||||||
|
/// </remarks>
|
||||||
Rational& Rational::operator%=(Rational const& rhs)
|
Rational& Rational::operator%=(Rational const& rhs)
|
||||||
{
|
{
|
||||||
PRAT lhsRat = this->ToPRAT();
|
PRAT lhsRat = this->ToPRAT();
|
||||||
@ -189,7 +198,7 @@ namespace CalcEngine
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
modrat(&lhsRat, rhsRat);
|
remrat(&lhsRat, rhsRat);
|
||||||
destroyrat(rhsRat);
|
destroyrat(rhsRat);
|
||||||
}
|
}
|
||||||
catch (uint32_t error)
|
catch (uint32_t error)
|
||||||
@ -342,6 +351,13 @@ namespace CalcEngine
|
|||||||
return lhs;
|
return lhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate the remainder after division, the sign of a result will match the sign of lhs.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This function has the same behavior as the standard C/C++ operator '%', to calculate the modulus after division instead, use <see
|
||||||
|
/// cref="Rational::operator%"/> instead.
|
||||||
|
/// </remarks>
|
||||||
Rational operator%(Rational lhs, Rational const& rhs)
|
Rational operator%(Rational lhs, Rational const& rhs)
|
||||||
{
|
{
|
||||||
lhs %= rhs;
|
lhs %= rhs;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "Header Files/RationalMath.h"
|
#include "Header Files/RationalMath.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -387,3 +386,33 @@ Rational RationalMath::ATanh(Rational const& rat)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate the modulus after division, the sign of the result will match the sign of b.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// When one of the operand is negative
|
||||||
|
/// the result will differ from the C/C++ operator '%'
|
||||||
|
/// use <see cref="Rational::operator%"/> instead to calculate the remainder after division.
|
||||||
|
/// </remarks>
|
||||||
|
Rational RationalMath::Mod(Rational const& a, Rational const& b)
|
||||||
|
{
|
||||||
|
PRAT prat = a.ToPRAT();
|
||||||
|
PRAT pn = b.ToPRAT();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
modrat(&prat, pn);
|
||||||
|
destroyrat(pn);
|
||||||
|
}
|
||||||
|
catch (uint32_t error)
|
||||||
|
{
|
||||||
|
destroyrat(prat);
|
||||||
|
destroyrat(pn);
|
||||||
|
throw(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto res = Rational{ prat };
|
||||||
|
destroyrat(prat);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
#include <cassert>
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
|
|
||||||
#include "CalculatorResource.h"
|
#include "CalculatorResource.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -25,13 +24,18 @@ static constexpr wstring_view DEFAULT_NUMBER_STR = L"0";
|
|||||||
// Read strings for keys, errors, trig types, etc.
|
// Read strings for keys, errors, trig types, etc.
|
||||||
// These will be copied from the resources to local memory.
|
// These will be copied from the resources to local memory.
|
||||||
|
|
||||||
array<wstring, CSTRINGSENGMAX> CCalcEngine::s_engineStrings;
|
unordered_map<wstring, wstring> CCalcEngine::s_engineStrings;
|
||||||
|
|
||||||
void CCalcEngine::LoadEngineStrings(CalculationManager::IResourceProvider& resourceProvider)
|
void CCalcEngine::LoadEngineStrings(CalculationManager::IResourceProvider& resourceProvider)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < s_engineStrings.size(); i++)
|
for (const auto& sid : g_sids)
|
||||||
{
|
{
|
||||||
s_engineStrings[i] = resourceProvider.GetCEngineString(g_sids[i]);
|
auto locKey = wstring{ sid };
|
||||||
|
auto locString = resourceProvider.GetCEngineString(locKey);
|
||||||
|
if (!locString.empty())
|
||||||
|
{
|
||||||
|
s_engineStrings[locKey] = locString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,42 +58,47 @@ void CCalcEngine::InitialOneTimeOnlySetup(CalculationManager::IResourceProvider&
|
|||||||
// CCalcEngine::CCalcEngine
|
// CCalcEngine::CCalcEngine
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
CCalcEngine::CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, __in_opt ICalcDisplay *pCalcDisplay, __in_opt shared_ptr<IHistoryDisplay> pHistoryDisplay) :
|
CCalcEngine::CCalcEngine(
|
||||||
m_fPrecedence(fPrecedence),
|
bool fPrecedence,
|
||||||
m_fIntegerMode(fIntegerMode),
|
bool fIntegerMode,
|
||||||
m_pCalcDisplay(pCalcDisplay),
|
CalculationManager::IResourceProvider* const pResourceProvider,
|
||||||
m_resourceProvider(pResourceProvider),
|
__in_opt ICalcDisplay* pCalcDisplay,
|
||||||
m_nOpCode(0),
|
__in_opt shared_ptr<IHistoryDisplay> pHistoryDisplay)
|
||||||
m_nPrevOpCode(0),
|
: m_fPrecedence(fPrecedence)
|
||||||
m_bChangeOp(false),
|
, m_fIntegerMode(fIntegerMode)
|
||||||
m_bRecord(false),
|
, m_pCalcDisplay(pCalcDisplay)
|
||||||
m_bSetCalcState(false),
|
, m_resourceProvider(pResourceProvider)
|
||||||
m_input(DEFAULT_DEC_SEPARATOR),
|
, m_nOpCode(0)
|
||||||
m_nFE(FMT_FLOAT),
|
, m_nPrevOpCode(0)
|
||||||
m_memoryValue{ make_unique<Rational>() },
|
, m_bChangeOp(false)
|
||||||
m_holdVal{},
|
, m_bRecord(false)
|
||||||
m_currentVal{},
|
, m_bSetCalcState(false)
|
||||||
m_lastVal{},
|
, m_input(DEFAULT_DEC_SEPARATOR)
|
||||||
m_parenVals{},
|
, m_nFE(FMT_FLOAT)
|
||||||
m_precedenceVals{},
|
, m_memoryValue{ make_unique<Rational>() }
|
||||||
m_bError(false),
|
, m_holdVal{}
|
||||||
m_bInv(false),
|
, m_currentVal{}
|
||||||
m_bNoPrevEqu(true),
|
, m_lastVal{}
|
||||||
m_radix(DEFAULT_RADIX),
|
, m_parenVals{}
|
||||||
m_precision(DEFAULT_PRECISION),
|
, m_precedenceVals{}
|
||||||
m_cIntDigitsSav(DEFAULT_MAX_DIGITS),
|
, m_bError(false)
|
||||||
m_decGrouping(),
|
, m_bInv(false)
|
||||||
m_numberString(DEFAULT_NUMBER_STR),
|
, m_bNoPrevEqu(true)
|
||||||
m_nTempCom(0),
|
, m_radix(DEFAULT_RADIX)
|
||||||
m_openParenCount(0),
|
, m_precision(DEFAULT_PRECISION)
|
||||||
m_nOp(),
|
, m_cIntDigitsSav(DEFAULT_MAX_DIGITS)
|
||||||
m_nPrecOp(),
|
, m_decGrouping()
|
||||||
m_precedenceOpCount(0),
|
, m_numberString(DEFAULT_NUMBER_STR)
|
||||||
m_nLastCom(0),
|
, m_nTempCom(0)
|
||||||
m_angletype(ANGLE_DEG),
|
, m_openParenCount(0)
|
||||||
m_numwidth(QWORD_WIDTH),
|
, m_nOp()
|
||||||
m_HistoryCollector(pCalcDisplay, pHistoryDisplay, DEFAULT_DEC_SEPARATOR),
|
, m_nPrecOp()
|
||||||
m_groupSeparator(DEFAULT_GRP_SEPARATOR)
|
, m_precedenceOpCount(0)
|
||||||
|
, m_nLastCom(0)
|
||||||
|
, m_angletype(ANGLE_DEG)
|
||||||
|
, m_numwidth(QWORD_WIDTH)
|
||||||
|
, m_HistoryCollector(pCalcDisplay, pHistoryDisplay, DEFAULT_DEC_SEPARATOR)
|
||||||
|
, m_groupSeparator(DEFAULT_GRP_SEPARATOR)
|
||||||
{
|
{
|
||||||
InitChopNumbers();
|
InitChopNumbers();
|
||||||
|
|
||||||
@ -168,7 +177,7 @@ void CCalcEngine::SettingsChanged()
|
|||||||
m_HistoryCollector.SetDecimalSymbol(m_decimalSeparator);
|
m_HistoryCollector.SetDecimalSymbol(m_decimalSeparator);
|
||||||
|
|
||||||
// put the new decimal symbol into the table used to draw the decimal key
|
// put the new decimal symbol into the table used to draw the decimal key
|
||||||
s_engineStrings[IDS_DECIMAL] = m_decimalSeparator;
|
s_engineStrings[SIDS_DECIMAL_SEPARATOR] = m_decimalSeparator;
|
||||||
|
|
||||||
// we need to redraw to update the decimal point button
|
// we need to redraw to update the decimal point button
|
||||||
numChanged = true;
|
numChanged = true;
|
||||||
|
@ -12,30 +12,24 @@
|
|||||||
*
|
*
|
||||||
* Author:
|
* Author:
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
#include "pch.h"
|
|
||||||
|
#include <string>
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
#include "Header Files/CalcUtils.h"
|
#include "Header Files/CalcUtils.h"
|
||||||
|
|
||||||
#define IDC_RADSIN IDC_UNARYLAST+1
|
|
||||||
#define IDC_RADCOS IDC_UNARYLAST+2
|
|
||||||
#define IDC_RADTAN IDC_UNARYLAST+3
|
|
||||||
#define IDC_GRADSIN IDC_UNARYLAST+4
|
|
||||||
#define IDC_GRADCOS IDC_UNARYLAST+5
|
|
||||||
#define IDC_GRADTAN IDC_UNARYLAST+6
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CalcEngine;
|
using namespace CalcEngine;
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
// NPrecedenceOfOp
|
// NPrecedenceOfOp
|
||||||
//
|
//
|
||||||
// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
||||||
// 0 is returned. Higher the number, higher the precedence of the operator.
|
// 0 is returned. Higher the number, higher the precedence of the operator.
|
||||||
int NPrecedenceOfOp(int nopCode)
|
int NPrecedenceOfOp(int nopCode)
|
||||||
{
|
{
|
||||||
static uint8_t rgbPrec[] = { 0,0, IDC_OR,0, IDC_XOR,0, IDC_AND,1,
|
static uint8_t rgbPrec[] = { 0, 0, IDC_OR, 0, IDC_XOR, 0, IDC_AND, 1, IDC_ADD, 2, IDC_SUB, 2, IDC_RSHF,
|
||||||
IDC_ADD,2, IDC_SUB,2, IDC_RSHF,3, IDC_LSHF,3,
|
3, IDC_LSHF, 3, IDC_MOD, 3, IDC_DIV, 3, IDC_MUL, 3, IDC_PWR, 4, IDC_ROOT, 4 };
|
||||||
IDC_MOD,3, IDC_DIV,3, IDC_MUL,3, IDC_PWR,4, IDC_ROOT, 4 };
|
|
||||||
unsigned int iPrec;
|
unsigned int iPrec;
|
||||||
|
|
||||||
iPrec = 0;
|
iPrec = 0;
|
||||||
@ -48,7 +42,6 @@ namespace {
|
|||||||
iPrec = 0;
|
iPrec = 0;
|
||||||
}
|
}
|
||||||
return rgbPrec[iPrec + 1];
|
return rgbPrec[iPrec + 1];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +89,7 @@ void CCalcEngine::ProcessCommand(OpCode wParam)
|
|||||||
|
|
||||||
void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
||||||
{
|
{
|
||||||
int nx, ni;
|
int nx, ni;
|
||||||
|
|
||||||
// Save the last command. Some commands are not saved in this manor, these
|
// Save the last command. Some commands are not saved in this manor, these
|
||||||
// commands are:
|
// commands are:
|
||||||
@ -131,18 +124,13 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
// Toggle Record/Display mode if appropriate.
|
// Toggle Record/Display mode if appropriate.
|
||||||
if (m_bRecord)
|
if (m_bRecord)
|
||||||
{
|
{
|
||||||
if (IsOpInRange(wParam, IDC_AND, IDC_MMINUS) ||
|
if (IsOpInRange(wParam, IDC_AND, IDC_MMINUS) || IsOpInRange(wParam, IDC_OPENP, IDC_CLOSEP) || IsOpInRange(wParam, IDM_HEX, IDM_BIN)
|
||||||
IsOpInRange(wParam, IDC_OPENP, IDC_CLOSEP) ||
|
|| IsOpInRange(wParam, IDM_QWORD, IDM_BYTE) || IsOpInRange(wParam, IDM_DEG, IDM_GRAD)
|
||||||
IsOpInRange(wParam, IDM_HEX, IDM_BIN) ||
|
|| IsOpInRange(wParam, IDC_BINEDITSTART, IDC_BINEDITSTART + 63) || (IDC_INV == wParam) || (IDC_SIGN == wParam && 10 != m_radix))
|
||||||
IsOpInRange(wParam, IDM_QWORD, IDM_BYTE) ||
|
|
||||||
IsOpInRange(wParam, IDM_DEG, IDM_GRAD) ||
|
|
||||||
IsOpInRange(wParam, IDC_BINEDITSTART, IDC_BINEDITSTART + 63) ||
|
|
||||||
(IDC_INV == wParam) ||
|
|
||||||
(IDC_SIGN == wParam && 10 != m_radix))
|
|
||||||
{
|
{
|
||||||
m_bRecord = false;
|
m_bRecord = false;
|
||||||
m_currentVal = m_input.ToRational(m_radix, m_precision);
|
m_currentVal = m_input.ToRational(m_radix, m_precision);
|
||||||
DisplayNum(); // Causes 3.000 to shrink to 3. on first op.
|
DisplayNum(); // Causes 3.000 to shrink to 3. on first op.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -247,9 +235,9 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* do the last operation and then if the precedence array is not
|
/* do the last operation and then if the precedence array is not
|
||||||
* empty or the top is not the '(' demarcator then pop the top
|
* empty or the top is not the '(' demarcator then pop the top
|
||||||
* of the array and recheck precedence against the new operator
|
* of the array and recheck precedence against the new operator
|
||||||
*/
|
*/
|
||||||
m_currentVal = DoOperation(m_nOpCode, m_currentVal, m_lastVal);
|
m_currentVal = DoOperation(m_nOpCode, m_currentVal, m_lastVal);
|
||||||
m_nPrevOpCode = m_nOpCode;
|
m_nPrevOpCode = m_nOpCode;
|
||||||
|
|
||||||
@ -278,7 +266,6 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
m_HistoryCollector.PopLastOpndStart();
|
m_HistoryCollector.PopLastOpndStart();
|
||||||
goto DoPrecedenceCheckAgain;
|
goto DoPrecedenceCheckAgain;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,11 +330,9 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
/* reset the m_bInv flag and indicators if it is set
|
/* reset the m_bInv flag and indicators if it is set
|
||||||
and have been used */
|
and have been used */
|
||||||
|
|
||||||
if (m_bInv &&
|
if (m_bInv
|
||||||
((wParam == IDC_CHOP) ||
|
&& ((wParam == IDC_CHOP) || (wParam == IDC_SIN) || (wParam == IDC_COS) || (wParam == IDC_TAN) || (wParam == IDC_LN) || (wParam == IDC_DMS)
|
||||||
(wParam == IDC_SIN) || (wParam == IDC_COS) || (wParam == IDC_TAN) ||
|
|| (wParam == IDC_DEGREES) || (wParam == IDC_SINH) || (wParam == IDC_COSH) || (wParam == IDC_TANH)))
|
||||||
(wParam == IDC_LN) || (wParam == IDC_DMS) || (wParam == IDC_DEGREES) ||
|
|
||||||
(wParam == IDC_SINH) || (wParam == IDC_COSH) || (wParam == IDC_TANH)))
|
|
||||||
{
|
{
|
||||||
m_bInv = false;
|
m_bInv = false;
|
||||||
}
|
}
|
||||||
@ -381,24 +366,25 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
{
|
{
|
||||||
if (!m_bChangeOp)
|
if (!m_bChangeOp)
|
||||||
{
|
{
|
||||||
// A special goody we are doing to preserve the history, if all was done was serious of unary operations last
|
// Preserve history, if everything done before was a series of unary operations.
|
||||||
CheckAndAddLastBinOpToHistory(false);
|
CheckAndAddLastBinOpToHistory(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastVal = 0;
|
m_lastVal = 0;
|
||||||
|
|
||||||
m_bChangeOp = false;
|
m_bChangeOp = false;
|
||||||
m_precedenceOpCount = m_nTempCom = m_nLastCom = m_nOpCode = m_openParenCount = 0;
|
m_openParenCount = 0;
|
||||||
|
m_precedenceOpCount = m_nTempCom = m_nLastCom = m_nOpCode = 0;
|
||||||
m_nPrevOpCode = 0;
|
m_nPrevOpCode = 0;
|
||||||
m_bNoPrevEqu = true;
|
m_bNoPrevEqu = true;
|
||||||
|
|
||||||
|
|
||||||
/* clear the parenthesis status box indicator, this will not be
|
/* clear the parenthesis status box indicator, this will not be
|
||||||
cleared for CENTR */
|
cleared for CENTR */
|
||||||
if (nullptr != m_pCalcDisplay)
|
if (nullptr != m_pCalcDisplay)
|
||||||
{
|
{
|
||||||
m_pCalcDisplay->SetParenDisplayText(L"");
|
m_pCalcDisplay->SetParenthesisNumber(0);
|
||||||
m_pCalcDisplay->SetExpressionDisplay(make_shared<CalculatorVector<pair<wstring, int>>>(), make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
m_pCalcDisplay->SetExpressionDisplay(
|
||||||
|
make_shared<CalculatorVector<pair<wstring, int>>>(), make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_HistoryCollector.ClearHistoryLine(wstring());
|
m_HistoryCollector.ClearHistoryLine(wstring());
|
||||||
@ -441,7 +427,7 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
// automatic closing of all the parenthesis to get a meaningful result as well as ensure data integrity
|
// automatic closing of all the parenthesis to get a meaningful result as well as ensure data integrity
|
||||||
m_nTempCom = m_nLastCom; // Put back this last saved command to the prev state so ) can be handled properly
|
m_nTempCom = m_nLastCom; // Put back this last saved command to the prev state so ) can be handled properly
|
||||||
ProcessCommand(IDC_CLOSEP);
|
ProcessCommand(IDC_CLOSEP);
|
||||||
m_nLastCom = m_nTempCom; // Actually this is IDC_CLOSEP
|
m_nLastCom = m_nTempCom; // Actually this is IDC_CLOSEP
|
||||||
m_nTempCom = (int)wParam; // put back in the state where last op seen was IDC_CLOSEP, and current op is IDC_EQU
|
m_nTempCom = (int)wParam; // put back in the state where last op seen was IDC_CLOSEP, and current op is IDC_EQU
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +477,8 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
m_HistoryCollector.CompleteHistoryLine(groupedString);
|
m_HistoryCollector.CompleteHistoryLine(groupedString);
|
||||||
if (nullptr != m_pCalcDisplay)
|
if (nullptr != m_pCalcDisplay)
|
||||||
{
|
{
|
||||||
m_pCalcDisplay->SetExpressionDisplay(make_shared<CalculatorVector<pair<wstring, int>>>(), make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
m_pCalcDisplay->SetExpressionDisplay(
|
||||||
|
make_shared<CalculatorVector<pair<wstring, int>>>(), make_shared<CalculatorVector<shared_ptr<IExpressionCommand>>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +588,7 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
// Set the "(=xx" indicator.
|
// Set the "(=xx" indicator.
|
||||||
if (nullptr != m_pCalcDisplay)
|
if (nullptr != m_pCalcDisplay)
|
||||||
{
|
{
|
||||||
m_pCalcDisplay->SetParenDisplayText(m_openParenCount ? to_wstring(m_openParenCount) : L"");
|
m_pCalcDisplay->SetParenthesisNumber(m_openParenCount >= 0 ? static_cast<unsigned int>(m_openParenCount) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_bError)
|
if (!m_bError)
|
||||||
@ -755,7 +742,6 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam)
|
|||||||
m_bInv = !m_bInv;
|
m_bInv = !m_bInv;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function to resolve one item on the precedence stack.
|
// Helper function to resolve one item on the precedence stack.
|
||||||
@ -820,7 +806,6 @@ void CCalcEngine::CheckAndAddLastBinOpToHistory(bool addToHistory)
|
|||||||
// So erase the last operand
|
// So erase the last operand
|
||||||
m_HistoryCollector.RemoveLastOpndFromHistory();
|
m_HistoryCollector.RemoveLastOpndFromHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (m_HistoryCollector.FOpndAddedToHistory() && !m_bError)
|
else if (m_HistoryCollector.FOpndAddedToHistory() && !m_bError)
|
||||||
{
|
{
|
||||||
@ -829,8 +814,7 @@ void CCalcEngine::CheckAndAddLastBinOpToHistory(bool addToHistory)
|
|||||||
// Let us make a current value =. So in case of 4 SQRT (or a equation under braces) and then a new equation is started, we can just form
|
// Let us make a current value =. So in case of 4 SQRT (or a equation under braces) and then a new equation is started, we can just form
|
||||||
// a useful equation of sqrt(4) = 2 and continue a new equation from now on. But no point in doing this for things like
|
// a useful equation of sqrt(4) = 2 and continue a new equation from now on. But no point in doing this for things like
|
||||||
// MR, SUM etc. All you will get is 5 = 5 kind of no useful equation.
|
// MR, SUM etc. All you will get is 5 = 5 kind of no useful equation.
|
||||||
if ((IsUnaryOpCode(m_nLastCom) || IDC_SIGN == m_nLastCom || IDC_CLOSEP == m_nLastCom) &&
|
if ((IsUnaryOpCode(m_nLastCom) || IDC_SIGN == m_nLastCom || IDC_CLOSEP == m_nLastCom) && 0 == m_openParenCount)
|
||||||
0 == m_openParenCount)
|
|
||||||
{
|
{
|
||||||
if (addToHistory)
|
if (addToHistory)
|
||||||
{
|
{
|
||||||
@ -868,155 +852,93 @@ void CCalcEngine::DisplayAnnounceBinaryOperator()
|
|||||||
// Unary operator Function Name table Element
|
// Unary operator Function Name table Element
|
||||||
// since unary operators button names aren't exactly friendly for history purpose,
|
// since unary operators button names aren't exactly friendly for history purpose,
|
||||||
// we have this separate table to get its localized name and for its Inv function if it exists.
|
// we have this separate table to get its localized name and for its Inv function if it exists.
|
||||||
typedef struct
|
struct FunctionNameElement
|
||||||
{
|
{
|
||||||
int idsFunc; // index of string for the unary op function. Can be NULL, in which case it same as button name
|
wstring degreeString; // Used by default if there are no rad or grad specific strings.
|
||||||
int idsFuncInv; // index of string for Inv of unary op. Can be NULL, in case it is same as idsFunc
|
wstring inverseDegreeString; // Will fall back to degreeString if empty
|
||||||
bool fDontUseInExpEval; // true if this cant be used in reverse direction as well, ie. during expression evaluation
|
|
||||||
} UFNE;
|
wstring radString;
|
||||||
|
wstring inverseRadString; // Will fall back to radString if empty
|
||||||
|
|
||||||
|
wstring gradString;
|
||||||
|
wstring inverseGradString; // Will fall back to gradString if empty
|
||||||
|
|
||||||
|
bool hasAngleStrings = ((!radString.empty()) || (!inverseRadString.empty()) || (!gradString.empty()) || (!inverseGradString.empty()));
|
||||||
|
};
|
||||||
|
|
||||||
// Table for each unary operator
|
// Table for each unary operator
|
||||||
static const UFNE rgUfne[] =
|
static const std::unordered_map<int, FunctionNameElement> unaryOperatorStringTable = {
|
||||||
{
|
{ IDC_CHOP, { L"", SIDS_FRAC } },
|
||||||
/* IDC_CHOP */{ 0, IDS_FRAC, false },
|
|
||||||
/* IDC_ROL */{ 0, 0, true },
|
|
||||||
/* IDC_ROR */{ 0, 0, true },
|
|
||||||
|
|
||||||
/* IDC_COM */{ 0, 0, true },
|
{ IDC_SIN, { SIDS_SIND, SIDS_ASIND, SIDS_SINR, SIDS_ASINR, SIDS_SING, SIDS_ASING } },
|
||||||
/* IDC_SIN */{ IDS_SIND, IDS_ASIND, false }, // default in this table is degrees for sin,cos & tan
|
{ IDC_COS, { SIDS_COSD, SIDS_ACOSD, SIDS_COSR, SIDS_ACOSR, SIDS_COSG, SIDS_ACOSG } },
|
||||||
/* IDC_COS */{ IDS_COSD, IDS_ACOSD, false },
|
{ IDC_TAN, { SIDS_TAND, SIDS_ATAND, SIDS_TANR, SIDS_ATANR, SIDS_TANG, SIDS_ATANG } },
|
||||||
/* IDC_TAN */{ IDS_TAND, IDS_ATAND, false },
|
|
||||||
|
|
||||||
/* IDC_SINH */{ 0, IDS_ASINH, false },
|
{ IDC_SINH, { L"", SIDS_ASINH } },
|
||||||
/* IDC_COSH */{ 0, IDS_ACOSH, false },
|
{ IDC_COSH, { L"", SIDS_ACOSH } },
|
||||||
/* IDC_TANH */{ 0, IDS_ATANH, false },
|
{ IDC_TANH, { L"", SIDS_ATANH } },
|
||||||
|
|
||||||
/* IDC_LN */{ 0, IDS_POWE, false },
|
{ IDC_LN, { L"", SIDS_POWE } },
|
||||||
/* IDC_LOG */{ 0, 0, false },
|
{ IDC_SQR, { SIDS_SQR } },
|
||||||
/* IDC_SQRT */{ 0, 0, false },
|
{ IDC_CUB, { SIDS_CUBE } },
|
||||||
/* IDC_SQR */{ IDS_SQR, 0, false },
|
{ IDC_FAC, { SIDS_FACT } },
|
||||||
/* IDC_CUB */{ IDS_CUBE, 0, false },
|
{ IDC_REC, { SIDS_RECIPROC } },
|
||||||
/* IDC_FAC */{ IDS_FACT, 0, false },
|
{ IDC_DMS, { L"", SIDS_DEGREES } },
|
||||||
/* IDC_REC */{ IDS_REC, 0, false },
|
{ IDC_SIGN, { SIDS_NEGATE } },
|
||||||
/* IDC_DMS */{ 0, IDS_DEGREES, false },
|
{ IDC_DEGREES, { SIDS_DEGREES } }
|
||||||
/* IDC_CUBEROOT */{ 0, 0, false },
|
|
||||||
/* IDC_POW10 */{ 0, 0, false },
|
|
||||||
/* IDC_PERCENT */{ 0, 0, false },
|
|
||||||
|
|
||||||
/* IDC_RADSIN */{ IDS_SINR, IDS_ASINR, false },
|
|
||||||
/* IDC_RADCOS */{ IDS_COSR, IDS_ACOSR, false },
|
|
||||||
/* IDC_RADTAN */{ IDS_TANR, IDS_ATANR, false },
|
|
||||||
/* IDC_GRADCOS */{ IDS_SING, IDS_ASING, false },
|
|
||||||
/* IDC_GRADCOS */{ IDS_COSG, IDS_ACOSG, false },
|
|
||||||
/* IDC_GRADTAN */{ IDS_TANG, IDS_ATANG, false },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wstring_view CCalcEngine::OpCodeToUnaryString(int nOpCode, bool fInv, ANGLE_TYPE angletype)
|
wstring_view CCalcEngine::OpCodeToUnaryString(int nOpCode, bool fInv, ANGLE_TYPE angletype)
|
||||||
{
|
{
|
||||||
// Special cases for Sign and Degrees
|
|
||||||
if (IDC_SIGN == nOpCode)
|
|
||||||
{
|
|
||||||
return GetString(IDS_NEGATE);
|
|
||||||
}
|
|
||||||
if (IDC_DEGREES == nOpCode)
|
|
||||||
{
|
|
||||||
return GetString(IDS_DEGREES);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Correct the trigonometric functions with type of angle argument they take
|
|
||||||
if (ANGLE_RAD == angletype)
|
|
||||||
{
|
|
||||||
switch (nOpCode)
|
|
||||||
{
|
|
||||||
case IDC_SIN:
|
|
||||||
nOpCode = IDC_RADSIN;
|
|
||||||
break;
|
|
||||||
case IDC_COS:
|
|
||||||
nOpCode = IDC_RADCOS;
|
|
||||||
break;
|
|
||||||
case IDC_TAN:
|
|
||||||
nOpCode = IDC_RADTAN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ANGLE_GRAD == angletype)
|
|
||||||
{
|
|
||||||
switch (nOpCode)
|
|
||||||
{
|
|
||||||
case IDC_SIN:
|
|
||||||
nOpCode = IDC_GRADSIN;
|
|
||||||
break;
|
|
||||||
case IDC_COS:
|
|
||||||
nOpCode = IDC_GRADCOS;
|
|
||||||
break;
|
|
||||||
case IDC_TAN:
|
|
||||||
nOpCode = IDC_GRADTAN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to lookup the ID in the UFNE table
|
// Try to lookup the ID in the UFNE table
|
||||||
int ids = 0;
|
wstring ids = L"";
|
||||||
int iufne = nOpCode - IDC_UNARYFIRST;
|
|
||||||
if (iufne >= 0 && (size_t)iufne < size(rgUfne))
|
if (auto pair = unaryOperatorStringTable.find(nOpCode); pair != unaryOperatorStringTable.end())
|
||||||
{
|
{
|
||||||
if (fInv)
|
const FunctionNameElement& element = pair->second;
|
||||||
|
if (!element.hasAngleStrings || ANGLE_DEG == angletype)
|
||||||
{
|
{
|
||||||
ids = rgUfne[iufne].idsFuncInv;
|
if (fInv)
|
||||||
|
{
|
||||||
|
ids = element.inverseDegreeString;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ids.empty())
|
||||||
|
{
|
||||||
|
ids = element.degreeString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (0 == ids)
|
else if (ANGLE_RAD == angletype)
|
||||||
{
|
{
|
||||||
ids = rgUfne[iufne].idsFunc;
|
if (fInv)
|
||||||
|
{
|
||||||
|
ids = element.inverseRadString;
|
||||||
|
}
|
||||||
|
if (ids.empty())
|
||||||
|
{
|
||||||
|
ids = element.radString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (ANGLE_GRAD == angletype)
|
||||||
|
{
|
||||||
|
if (fInv)
|
||||||
|
{
|
||||||
|
ids = element.inverseGradString;
|
||||||
|
}
|
||||||
|
if (ids.empty())
|
||||||
|
{
|
||||||
|
ids = element.gradString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ids.empty())
|
||||||
|
{
|
||||||
|
return GetString(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we didn't find an ID in the table, use the op code.
|
// If we didn't find an ID in the table, use the op code.
|
||||||
if (0 == ids)
|
return OpCodeToString(nOpCode);
|
||||||
{
|
|
||||||
ids = IdStrFromCmdId(nOpCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetString(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Sets the Angle Mode for special unary op IDC's which are used to index to the table rgUfne
|
|
||||||
// and returns the equivalent plain IDC for trigonometric function. If it isn't a trigonometric function
|
|
||||||
// returns the passed in idc itself.
|
|
||||||
int CCalcEngine::IdcSetAngleTypeDecMode(int idc)
|
|
||||||
{
|
|
||||||
int idcAngleCmd = IDM_DEG;
|
|
||||||
|
|
||||||
switch (idc)
|
|
||||||
{
|
|
||||||
case IDC_RADSIN:
|
|
||||||
idcAngleCmd = IDM_RAD;
|
|
||||||
idc = IDC_SIN;
|
|
||||||
break;
|
|
||||||
case IDC_RADCOS:
|
|
||||||
idcAngleCmd = IDM_RAD;
|
|
||||||
idc = IDC_COS;
|
|
||||||
break;
|
|
||||||
case IDC_RADTAN:
|
|
||||||
idcAngleCmd = IDM_RAD;
|
|
||||||
idc = IDC_TAN;
|
|
||||||
break;
|
|
||||||
case IDC_GRADSIN:
|
|
||||||
idcAngleCmd = IDM_GRAD;
|
|
||||||
idc = IDC_SIN;
|
|
||||||
break;
|
|
||||||
case IDC_GRADCOS:
|
|
||||||
idcAngleCmd = IDM_GRAD;
|
|
||||||
idc = IDC_COS;
|
|
||||||
break;
|
|
||||||
case IDC_GRADTAN:
|
|
||||||
idcAngleCmd = IDM_GRAD;
|
|
||||||
idc = IDC_TAN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ProcessCommand(idcAngleCmd);
|
|
||||||
return idc;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCalcEngine::IsCurrentTooBigForTrig()
|
bool CCalcEngine::IsCurrentTooBigForTrig()
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
*
|
*
|
||||||
* Author:
|
* Author:
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
#include "pch.h"
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <regex>
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -23,7 +25,6 @@ constexpr uint32_t MAX_GROUPING_SIZE = 16;
|
|||||||
constexpr wstring_view c_decPreSepStr = L"[+-]?(\\d*)[";
|
constexpr wstring_view c_decPreSepStr = L"[+-]?(\\d*)[";
|
||||||
constexpr wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
|
constexpr wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************\
|
/****************************************************************************\
|
||||||
* void DisplayNum(void)
|
* void DisplayNum(void)
|
||||||
*
|
*
|
||||||
@ -35,18 +36,19 @@ constexpr wstring_view c_decPostSepStr = L"]?(\\d*)(?:e[+-]?(\\d*))?$";
|
|||||||
//
|
//
|
||||||
// State of calc last time DisplayNum was called
|
// State of calc last time DisplayNum was called
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
Rational value;
|
Rational value;
|
||||||
int32_t precision;
|
int32_t precision;
|
||||||
uint32_t radix;
|
uint32_t radix;
|
||||||
int nFE;
|
int nFE;
|
||||||
NUM_WIDTH numwidth;
|
NUM_WIDTH numwidth;
|
||||||
bool fIntMath;
|
bool fIntMath;
|
||||||
bool bRecord;
|
bool bRecord;
|
||||||
bool bUseSep;
|
bool bUseSep;
|
||||||
} LASTDISP;
|
} LASTDISP;
|
||||||
|
|
||||||
LASTDISP gldPrevious = { 0, -1, 0, -1, (NUM_WIDTH)-1, false, false, false };
|
static LASTDISP gldPrevious = { 0, -1, 0, -1, (NUM_WIDTH)-1, false, false, false };
|
||||||
|
|
||||||
// Truncates if too big, makes it a non negative - the number in rat. Doesn't do anything if not in INT mode
|
// Truncates if too big, makes it a non negative - the number in rat. Doesn't do anything if not in INT mode
|
||||||
CalcEngine::Rational CCalcEngine::TruncateNumForIntMath(CalcEngine::Rational const& rat)
|
CalcEngine::Rational CCalcEngine::TruncateNumForIntMath(CalcEngine::Rational const& rat)
|
||||||
@ -64,7 +66,7 @@ CalcEngine::Rational CCalcEngine::TruncateNumForIntMath(CalcEngine::Rational con
|
|||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
// if negative make positive by doing a twos complement
|
// if negative make positive by doing a twos complement
|
||||||
result = -(result) - 1;
|
result = -(result)-1;
|
||||||
result ^= m_chopNumbers[m_numwidth];
|
result ^= m_chopNumbers[m_numwidth];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,15 +84,8 @@ void CCalcEngine::DisplayNum(void)
|
|||||||
// something important has changed since the last time DisplayNum was
|
// something important has changed since the last time DisplayNum was
|
||||||
// called.
|
// called.
|
||||||
//
|
//
|
||||||
if (m_bRecord ||
|
if (m_bRecord || gldPrevious.value != m_currentVal || gldPrevious.precision != m_precision || gldPrevious.radix != m_radix || gldPrevious.nFE != (int)m_nFE
|
||||||
gldPrevious.value != m_currentVal ||
|
|| gldPrevious.bUseSep != true || gldPrevious.numwidth != m_numwidth || gldPrevious.fIntMath != m_fIntegerMode || gldPrevious.bRecord != m_bRecord)
|
||||||
gldPrevious.precision != m_precision ||
|
|
||||||
gldPrevious.radix != m_radix ||
|
|
||||||
gldPrevious.nFE != (int)m_nFE ||
|
|
||||||
gldPrevious.bUseSep != true ||
|
|
||||||
gldPrevious.numwidth != m_numwidth ||
|
|
||||||
gldPrevious.fIntMath != m_fIntegerMode ||
|
|
||||||
gldPrevious.bRecord != m_bRecord)
|
|
||||||
{
|
{
|
||||||
gldPrevious.precision = m_precision;
|
gldPrevious.precision = m_precision;
|
||||||
gldPrevious.radix = m_radix;
|
gldPrevious.radix = m_radix;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
/*** ***/
|
/*** ***/
|
||||||
/*** ***/
|
/*** ***/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
#include "pch.h"
|
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -55,7 +54,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||||||
|
|
||||||
uint64_t w64Bits = result.ToUInt64_t();
|
uint64_t w64Bits = result.ToUInt64_t();
|
||||||
uint64_t msb = (w64Bits >> (m_dwWordBitWidth - 1)) & 1;
|
uint64_t msb = (w64Bits >> (m_dwWordBitWidth - 1)) & 1;
|
||||||
w64Bits <<= 1; // LShift by 1
|
w64Bits <<= 1; // LShift by 1
|
||||||
w64Bits |= msb; // Set the prev Msb as the current Lsb
|
w64Bits |= msb; // Set the prev Msb as the current Lsb
|
||||||
|
|
||||||
result = w64Bits;
|
result = w64Bits;
|
||||||
@ -203,7 +202,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // end switch( op )
|
} // end switch( op )
|
||||||
}
|
}
|
||||||
catch (uint32_t nErrCode)
|
catch (uint32_t nErrCode)
|
||||||
{
|
{
|
||||||
@ -227,4 +226,3 @@ void CCalcEngine::DisplayError(uint32_t nError)
|
|||||||
|
|
||||||
m_HistoryCollector.ClearHistoryLine(errorString);
|
m_HistoryCollector.ClearHistoryLine(errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
|
|
||||||
using namespace CalcEngine;
|
using namespace CalcEngine;
|
||||||
@ -78,7 +77,7 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
|||||||
case IDC_DIV:
|
case IDC_DIV:
|
||||||
case IDC_MOD:
|
case IDC_MOD:
|
||||||
{
|
{
|
||||||
int iNumeratorSign = 1, iDenominatorSign = 1, iFinalSign = 1;
|
int iNumeratorSign = 1, iDenominatorSign = 1;
|
||||||
auto temp = result;
|
auto temp = result;
|
||||||
result = rhs;
|
result = rhs;
|
||||||
|
|
||||||
@ -107,20 +106,30 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
|||||||
|
|
||||||
if (operation == IDC_DIV)
|
if (operation == IDC_DIV)
|
||||||
{
|
{
|
||||||
iFinalSign = iNumeratorSign * iDenominatorSign;
|
|
||||||
result /= temp;
|
result /= temp;
|
||||||
|
if (m_fIntegerMode && (iNumeratorSign * iDenominatorSign) == -1)
|
||||||
|
{
|
||||||
|
result = -(Integer(result));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iFinalSign = iNumeratorSign;
|
if (m_fIntegerMode)
|
||||||
result %= temp;
|
{
|
||||||
}
|
// Programmer mode, use remrat (remainder after division)
|
||||||
|
result %= temp;
|
||||||
|
|
||||||
if (m_fIntegerMode && iFinalSign == -1)
|
if (iNumeratorSign == -1)
|
||||||
{
|
{
|
||||||
result = -(Integer(result));
|
result = -(Integer(result));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// other modes, use modrat (modulus after division)
|
||||||
|
result = Mod(result, temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
|
||||||
#include "Header Files/CalcEngine.h"
|
#include "Header Files/CalcEngine.h"
|
||||||
|
|
||||||
using namespace CalcEngine;
|
using namespace CalcEngine;
|
||||||
@ -65,7 +64,7 @@ int32_t CCalcEngine::DwWordBitWidthFromeNumWidth(NUM_WIDTH /*numwidth*/)
|
|||||||
|
|
||||||
uint32_t CCalcEngine::NRadixFromRadixType(RADIX_TYPE radixtype)
|
uint32_t CCalcEngine::NRadixFromRadixType(RADIX_TYPE radixtype)
|
||||||
{
|
{
|
||||||
static constexpr uint32_t rgnRadish[4] = { 16, 10, 8, 2 }; /* Number bases in the same order as radixtype */
|
static constexpr uint32_t rgnRadish[4] = { 16, 10, 8, 2 }; /* Number bases in the same order as radixtype */
|
||||||
uint32_t radix = 10;
|
uint32_t radix = 10;
|
||||||
|
|
||||||
// convert special bases into symbolic values
|
// convert special bases into symbolic values
|
||||||
|
11
src/CalcManager/CMakeLists.txt
Normal file
11
src/CalcManager/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
add_library(CalcManager
|
||||||
|
CalculatorHistory.cpp
|
||||||
|
CalculatorManager.cpp
|
||||||
|
ExpressionCommand.cpp
|
||||||
|
pch.cpp
|
||||||
|
UnitConverter.cpp
|
||||||
|
)
|
||||||
|
target_include_directories(CalcManager PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
add_subdirectory(Ratpack)
|
||||||
|
add_subdirectory(CEngine)
|
@ -45,8 +45,8 @@
|
|||||||
<AppContainerApplication>true</AppContainerApplication>
|
<AppContainerApplication>true</AppContainerApplication>
|
||||||
<ApplicationType>Windows Store</ApplicationType>
|
<ApplicationType>Windows Store</ApplicationType>
|
||||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||||
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0</WindowsTargetPlatformVersion>
|
||||||
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
|
<WindowsTargetPlatformMinVersion>10.0.18362.0</WindowsTargetPlatformMinVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<!-- This has to be exactly in this place for this to work -->
|
<!-- This has to be exactly in this place for this to work -->
|
||||||
@ -56,46 +56,46 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
@ -153,10 +153,11 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- /utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -169,10 +170,11 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- /utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -185,10 +187,11 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- /utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -201,10 +204,11 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- /utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -217,11 +221,12 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- /utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -234,10 +239,11 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- /utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -250,10 +256,11 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- /utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -266,10 +273,11 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- /utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -278,7 +286,6 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="CalcException.h" />
|
|
||||||
<ClInclude Include="CalculatorHistory.h" />
|
<ClInclude Include="CalculatorHistory.h" />
|
||||||
<ClInclude Include="CalculatorManager.h" />
|
<ClInclude Include="CalculatorManager.h" />
|
||||||
<ClInclude Include="CalculatorResource.h" />
|
<ClInclude Include="CalculatorResource.h" />
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
#include <cassert>
|
||||||
#include "CalculatorHistory.h"
|
#include "CalculatorHistory.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace CalculationManager;
|
using namespace CalculationManager;
|
||||||
|
|
||||||
CalculatorHistory::CalculatorHistory(size_t maxSize) :
|
CalculatorHistory::CalculatorHistory(size_t maxSize)
|
||||||
m_maxHistorySize(maxSize)
|
: m_maxHistorySize(maxSize)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int CalculatorHistory::AddToHistory(_In_ shared_ptr<CalculatorVector <pair<wstring, int>>> const &tokens, _In_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const &commands, _In_ wstring_view result)
|
unsigned int CalculatorHistory::AddToHistory(
|
||||||
|
_In_ shared_ptr<CalculatorVector<pair<wstring, int>>> const& tokens,
|
||||||
|
_In_ shared_ptr<CalculatorVector<shared_ptr<IExpressionCommand>>> const& commands,
|
||||||
|
_In_ wstring_view result)
|
||||||
{
|
{
|
||||||
unsigned int addedIndex;
|
unsigned int addedIndex;
|
||||||
wstring generatedExpression;
|
wstring generatedExpression;
|
||||||
@ -31,8 +35,7 @@ unsigned int CalculatorHistory::AddToHistory(_In_ shared_ptr<CalculatorVector <p
|
|||||||
return addedIndex;
|
return addedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CalculatorHistory::AddItem(_In_ shared_ptr<HISTORYITEM> const& spHistoryItem)
|
||||||
unsigned int CalculatorHistory::AddItem(_In_ shared_ptr<HISTORYITEM> const &spHistoryItem)
|
|
||||||
{
|
{
|
||||||
if (m_historyItems.size() >= m_maxHistorySize)
|
if (m_historyItems.size() >= m_maxHistorySize)
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user