From 5b1788167610e256ac6c53a2b797ab672a31a6aa Mon Sep 17 00:00:00 2001 From: Eric Paniagua Date: Fri, 4 Sep 2020 23:05:49 -0700 Subject: [PATCH] Issue #840: Fix verified by test. Regression test added. Signed-off-by: Eric Paniagua --- testing/issue_840/test/simulator_test.cpp | 45 ++++++++++++++++++++--- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/testing/issue_840/test/simulator_test.cpp b/testing/issue_840/test/simulator_test.cpp index 1f37df88..0820bccd 100644 --- a/testing/issue_840/test/simulator_test.cpp +++ b/testing/issue_840/test/simulator_test.cpp @@ -37,7 +37,7 @@ using ::testing::IsEmpty; class Issue840 : public VirtualDeviceTest {}; -TEST_F(Issue840, Reproduces) { +TEST_F(Issue840, HasNotRegressed) { sim_.Press(2, 1); // Press System_PowerDown auto state = RunCycle(); @@ -57,10 +57,7 @@ TEST_F(Issue840, Reproduces) { sim_.Release(2, 1); // Release System_PowerDown state = RunCycle(); - ASSERT_EQ(state->SystemControlReports().size(), 1); - EXPECT_EQ( - state->SystemControlReports(0).Key(), - 0 /* null report */); + ASSERT_EQ(state->SystemControlReports().size(), 0); sim_.Release(3, 5); // Release System_Sleep state = RunCycle(); @@ -75,6 +72,44 @@ TEST_F(Issue840, Reproduces) { EXPECT_EQ(state->SystemControlReports().size(), 0); } +// TEST_F(Issue840, Reproduces) { +// sim_.Press(2, 1); // Press System_PowerDown +// auto state = RunCycle(); +// +// ASSERT_EQ(state->SystemControlReports().size(), 1); +// EXPECT_EQ( +// state->SystemControlReports(0).Key(), +// System_PowerDown.getKeyCode()); +// +// sim_.Press(3, 5); // Press System_Sleep +// state = RunCycle(); +// +// ASSERT_EQ(state->SystemControlReports().size(), 1); +// EXPECT_EQ( +// state->SystemControlReports(0).Key(), +// System_Sleep.getKeyCode()); +// +// sim_.Release(2, 1); // Release System_PowerDown +// state = RunCycle(); +// +// ASSERT_EQ(state->SystemControlReports().size(), 1); +// EXPECT_EQ( +// state->SystemControlReports(0).Key(), +// 0 /* null report */); +// +// sim_.Release(3, 5); // Release System_Sleep +// state = RunCycle(); +// +// ASSERT_EQ(state->SystemControlReports().size(), 1); +// EXPECT_EQ( +// state->SystemControlReports(0).Key(), +// 0 /* null report */); +// +// state = RunCycle(); +// +// EXPECT_EQ(state->SystemControlReports().size(), 0); +// } + } // namespace } // namespace testing } // namespace kaleidoscope