Skip to content

Edit UnitConverterTestUnitTypeSwitching (Edit UnitConverterTest.cpp) #2263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/CalculatorUnitTests/UnitConverterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,15 @@ namespace UnitConverterUnitTests
// Test switching of unit types
void UnitConverterTest::UnitConverterTestUnitTypeSwitching()
{
// Enter 57 into the from field, then switch focus to the to field (making it the new from field)
s_unitConverter->SendCommand(Command::Five);
s_unitConverter->SendCommand(Command::Seven);
s_unitConverter->SwitchActive(wstring(L"57"));
// Now set unit conversion to go from kilograms to pounds
// Now set unit conversion to go from pounds to kilograms
s_unitConverter->SetCurrentCategory(s_testWeight);
s_unitConverter->SetCurrentUnitTypes(s_testKilograms, s_testPounds);
s_unitConverter->SetCurrentUnitTypes(s_testPounds, s_testKilograms);
// Enter 5 into the from field, then switch focus to the to field (making it the new from field) (switch focus to kilograms)
s_unitConverter->SendCommand(Command::Five);
s_unitConverter->SwitchActive(wstring(L"2.26796"));
VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"5"), wstring(L"2.26796")));
VERIFY_IS_TRUE(s_testVMCallback->CheckSuggestedValues(vector<tuple<wstring, Unit>>()));
// Enter 5 again into the to field
s_unitConverter->SendCommand(Command::Five);
VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"5"), wstring(L"11.0231")));
VERIFY_IS_TRUE(s_testVMCallback->CheckSuggestedValues(vector<tuple<wstring, Unit>>()));
Expand Down