EX-Display
EX-Display
Loading...
Searching...
No Matches
MockInput.h
Go to the documentation of this file.
1/*
2 * © 2024 Peter Cole
3 *
4 * This is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * It is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this code. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef MOCKINPUT_H
19#define MOCKINPUT_H
20
21#include "InputInterface.h"
22#include <gmock/gmock.h>
23
25class MockInput : public InputInterface {
26public:
28
30
31 MOCK_METHOD(void, begin, (), (override));
32
33 MOCK_METHOD(void, check, (), (override));
34
36
37 void setNeedsDisplay(int displayId) { _needsDisplay = displayId; }
38
40 MockInput *newInput = new MockInput(needsDisplay);
41 return newInput;
42 }
43};
44
45#endif // MOCKINPUT_H
Class to abstract away all physical input implementatio to enable multiple input types Default return...
Definition InputInterface.h:28
int needsDisplay()
Test if this InputInterface requires a display instance - needed for TFT_eSPI as it shares the instan...
Definition InputInterface.cpp:26
virtual void begin()=0
Perform any initial once off setup or configuration here and call only once.
bool _isCalibrating
Flag if the input interface is undergoing calibration - needed for touch screens.
Definition InputInterface.h:79
int _needsDisplay
Display ID if this input interface requires a display instance - needed for TFT_eSPI as it shares the...
Definition InputInterface.h:82
bool isCalibrating()
Test if this InputInterface is undergoing calibration as required by touch screens.
Definition InputInterface.cpp:24
virtual void check()=0
Call this method at least once per main loop to monitor for input actions Any actions should call the...
Mock physical input class.
Definition MockInput.h:25
static MockInput * create(int needsDisplay)
Definition MockInput.h:39
MockInput()
Definition MockInput.h:27
void setNeedsDisplay(int displayId)
Definition MockInput.h:37
MockInput(int needsDisplay)
Definition MockInput.h:29
MOCK_METHOD(void, check,(),(override))
void setIsCalibrating(bool isCalibrating)
Definition MockInput.h:35
MOCK_METHOD(void, begin,(),(override))