From c5f2fe667dfd6e8835ff02ad2fab05d8eb7b5fd7 Mon Sep 17 00:00:00 2001 From: Jamiras Date: Sun, 6 Mar 2022 08:54:58 -0700 Subject: [PATCH] fix 'Track as %' not being checked when opening an active achievement using it --- src/ui/viewmodels/TriggerViewModel.cpp | 2 +- tests/ui/viewmodels/TriggerViewModel_Tests.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/viewmodels/TriggerViewModel.cpp b/src/ui/viewmodels/TriggerViewModel.cpp index 4985fc3c..91e1b8da 100644 --- a/src/ui/viewmodels/TriggerViewModel.cpp +++ b/src/ui/viewmodels/TriggerViewModel.cpp @@ -402,7 +402,7 @@ void TriggerViewModel::InitializeGroups(const rc_trigger_t& pTrigger) m_vGroups.RemoveNotifyTarget(*this); m_vGroups.BeginUpdate(); - SetMeasuredTrackedAsPercent(m_pTrigger != nullptr ? m_pTrigger->measured_as_percent : false); + SetMeasuredTrackedAsPercent(pTrigger.measured_as_percent); // this will not update the conditions collection because OnValueChange ignores it when m_vGroups.IsUpdating SetSelectedGroupIndex(0); diff --git a/tests/ui/viewmodels/TriggerViewModel_Tests.cpp b/tests/ui/viewmodels/TriggerViewModel_Tests.cpp index 8f7a7cfb..f99b6ce0 100644 --- a/tests/ui/viewmodels/TriggerViewModel_Tests.cpp +++ b/tests/ui/viewmodels/TriggerViewModel_Tests.cpp @@ -233,6 +233,8 @@ TEST_CLASS(TriggerViewModel_Tests) ParseAndRegenerate("0xH1234=0xH2345"); // one condition ParseAndRegenerate("0xH1234=0xH2345_0xX5555=1.3._R:0x face=678"); // several conditions ParseAndRegenerate("I:0x 1234_A:0xH2345_0xH7777=345"); // addsource/addaddress chain + ParseAndRegenerate("M:0xH1234>3"); // measured (not as percent) + ParseAndRegenerate("Q:0xH1234>3"); // measured (as percent) } TEST_METHOD(TestParseAndRegenerateWithAlts)