Optimize BitFlipPanel to suppress flicker when users switch between bit lengths (#640)

* Optimize BitFlipPanel

* remove namespace in cpp file

* improve localization + add tests

* add helper to compare ivector

* Modify how the control manages AutomationProperties::Name
This commit is contained in:
Rudy Huyn
2019-08-26 09:31:13 -07:00
committed by Eric Wong
parent eb24c085bc
commit 41e2e97591
26 changed files with 793 additions and 621 deletions

View File

@@ -5,6 +5,7 @@
#include "AppResourceProvider.h"
#include "NavCategory.h"
#include "BitLength.h"
namespace CalculatorUnitTests
{
@@ -13,10 +14,6 @@ namespace CalculatorUnitTests
namespace CalculatorApp
{
inline constexpr auto QwordType = 1;
inline constexpr auto DwordType = 2;
inline constexpr auto WordType = 3;
inline constexpr auto ByteType = 4;
inline constexpr auto HexBase = 5;
inline constexpr auto DecBase = 6;
inline constexpr auto OctBase = 7;
@@ -30,7 +27,7 @@ namespace CalculatorApp
CalculatorApp::Common::ViewMode mode,
CalculatorApp::Common::CategoryGroupType modeType,
int programmerNumberBase = -1,
int bitLengthType = -1);
CalculatorApp::Common::BitLength bitLengthType = CalculatorApp::Common::BitLength::BitLengthUnknown);
static bool HasStringToPaste()
{
return ClipboardTextFormat() >= 0;
@@ -41,14 +38,18 @@ namespace CalculatorApp
private:
static int ClipboardTextFormat();
static Platform::String
^ ValidatePasteExpression(Platform::String ^ pastedText, CalculatorApp::Common::ViewMode mode, int programmerNumberBase, int bitLengthType);
^ ValidatePasteExpression(
Platform::String ^ pastedText,
CalculatorApp::Common::ViewMode mode,
int programmerNumberBase,
CalculatorApp::Common::BitLength bitLengthType);
static Platform::String
^ ValidatePasteExpression(
Platform::String ^ pastedText,
CalculatorApp::Common::ViewMode mode,
CalculatorApp::Common::CategoryGroupType modeType,
int programmerNumberBase,
int bitLengthType);
CalculatorApp::Common::BitLength bitLengthType);
static std::vector<std::wstring>
ExtractOperands(const std::wstring& pasteExpression, CalculatorApp::Common::ViewMode mode);
@@ -57,13 +58,13 @@ namespace CalculatorApp
CalculatorApp::Common::ViewMode mode,
CalculatorApp::Common::CategoryGroupType modeType,
int programmerNumberBase = -1,
int bitLengthType = -1);
CalculatorApp::Common::BitLength bitLengthType = CalculatorApp::Common::BitLength::BitLengthUnknown);
static std::pair<size_t, uint64_t> GetMaxOperandLengthAndValue(
CalculatorApp::Common::ViewMode mode,
CalculatorApp::Common::CategoryGroupType modeType,
int programmerNumberBase = -1,
int bitLengthType = -1);
CalculatorApp::Common::BitLength bitLengthType = CalculatorApp::Common::BitLength::BitLengthUnknown);
static std::wstring SanitizeOperand(const std::wstring& operand);
static bool TryOperandToULL(const std::wstring& operand, int numberBase, unsigned long long int& result);
static size_t OperandLength(