aboutsummaryrefslogtreecommitdiff
path: root/tests/test_common/test_fixture.cpp
diff options
context:
space:
mode:
authorColin T.A. Gray <colinta@gmail.com>2017-12-14 16:15:52 -0700
committerJack Humbert <jack.humb@gmail.com>2017-12-15 13:23:30 -0500
commit4ea3bbdb4cbb02310623c9dfc464d84e4f653492 (patch)
tree7914b5019cb55d0a343ec89385d95795f597cac5 /tests/test_common/test_fixture.cpp
parentbad839e6ac815f9fc0836d8170b716838fbc87b7 (diff)
downloadqmk_firmware-4ea3bbdb4cbb02310623c9dfc464d84e4f653492.tar.gz
qmk_firmware-4ea3bbdb4cbb02310623c9dfc464d84e4f653492.zip
add tests for action_layer.c and reset layer state after tests
Diffstat (limited to 'tests/test_common/test_fixture.cpp')
-rw-r--r--tests/test_common/test_fixture.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test_common/test_fixture.cpp b/tests/test_common/test_fixture.cpp
index 4084ee9c6..d86681eea 100644
--- a/tests/test_common/test_fixture.cpp
+++ b/tests/test_common/test_fixture.cpp
@@ -7,6 +7,10 @@
7#include "action_tapping.h" 7#include "action_tapping.h"
8 8
9extern "C" { 9extern "C" {
10#include "action_layer.h"
11}
12
13extern "C" {
10 void set_time(uint32_t t); 14 void set_time(uint32_t t);
11 void advance_time(uint32_t ms); 15 void advance_time(uint32_t ms);
12} 16}
@@ -30,11 +34,12 @@ TestFixture::TestFixture() {
30 34
31TestFixture::~TestFixture() { 35TestFixture::~TestFixture() {
32 TestDriver driver; 36 TestDriver driver;
37 layer_clear();
33 clear_all_keys(); 38 clear_all_keys();
34 // Run for a while to make sure all keys are completely released 39 // Run for a while to make sure all keys are completely released
35 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(AnyNumber()); 40 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(AnyNumber());
36 idle_for(TAPPING_TERM + 10); 41 idle_for(TAPPING_TERM + 10);
37 testing::Mock::VerifyAndClearExpectations(&driver); 42 testing::Mock::VerifyAndClearExpectations(&driver);
38 // Verify that the matrix really is cleared 43 // Verify that the matrix really is cleared
39 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(Between(0, 1)); 44 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(Between(0, 1));
40} 45}
@@ -48,4 +53,4 @@ void TestFixture::idle_for(unsigned time) {
48 for (unsigned i=0; i<time; i++) { 53 for (unsigned i=0; i<time; i++) {
49 run_one_scan_loop(); 54 run_one_scan_loop();
50 } 55 }
51} \ No newline at end of file 56}