mock_Light.h
4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/**
\file mock_Light.h
Copyright Notice\n
Copyright (C) 2017 Jan Rogall - developer\n
Copyright (C) 2017 Moritz Wirger - developer\n
This file is part of hueplusplus.
hueplusplus is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
hueplusplus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with hueplusplus. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef _MOCK_HUE_LIGHT_H
#define _MOCK_HUE_LIGHT_H
#include <string>
#include <vector>
#include <gmock/gmock.h>
#include "../testhelper.h"
#include "hueplusplus/Light.h"
#include "json/json.hpp"
//! Mock Class
class MockLight : public hueplusplus::Light
{
public:
MockLight(std::shared_ptr<const hueplusplus::IHttpHandler> handler)
: Light(1, hueplusplus::HueCommandAPI(getBridgeIp(), getBridgePort(), getBridgeUsername(), handler), nullptr,
nullptr, nullptr, std::chrono::steady_clock::duration::max(), nullptr)
{
// Set refresh duration to max, so random refreshes do not hinder the test setups
}
nlohmann::json& getState() { return state.getValue(); }
MOCK_METHOD1(On, bool(uint8_t transition));
MOCK_METHOD1(Off, bool(uint8_t transition));
MOCK_METHOD0(isOn, bool());
MOCK_CONST_METHOD0(isOn, bool());
MOCK_CONST_METHOD0(getId, int());
MOCK_CONST_METHOD0(getType, std::string());
MOCK_METHOD0(getName, std::string());
MOCK_CONST_METHOD0(getName, std::string());
MOCK_CONST_METHOD0(getModelId, std::string());
MOCK_CONST_METHOD0(getUId, std::string());
MOCK_CONST_METHOD0(getManufacturername, std::string());
MOCK_CONST_METHOD0(getLuminaireUId, std::string());
MOCK_METHOD0(getSwVersion, std::string());
MOCK_CONST_METHOD0(getSwVersion, std::string());
MOCK_METHOD1(setName, bool(const std::string& name));
MOCK_CONST_METHOD0(getColorType, hueplusplus::ColorType());
MOCK_CONST_METHOD0(hasBrightnessControl, bool());
MOCK_CONST_METHOD0(hasTemperatureControl, bool());
MOCK_CONST_METHOD0(hasColorControl, bool());
MOCK_METHOD2(setBrightness, bool(unsigned int bri, uint8_t transition));
MOCK_CONST_METHOD0(getBrightness, unsigned int());
MOCK_METHOD0(getBrightness, unsigned int());
MOCK_METHOD2(setColorTemperature, bool(unsigned int mired, uint8_t transition));
MOCK_CONST_METHOD0(getColorTemperature, unsigned int());
MOCK_METHOD0(getColorTemperature, unsigned int());
MOCK_METHOD2(setColorHue, bool(uint16_t hue, uint8_t transition));
MOCK_METHOD2(setColorSaturation, bool(uint8_t sat, uint8_t transition));
MOCK_METHOD2(setColorHueSaturation, bool(const hueplusplus::HueSaturation& hueSat, uint8_t transition));
MOCK_CONST_METHOD0(getColorHueSaturation, hueplusplus::HueSaturation());
MOCK_METHOD0(getColorHueSaturation, hueplusplus::HueSaturation());
MOCK_METHOD2(setColorXY, bool(const hueplusplus::XYBrightness& xy, uint8_t transition));
MOCK_CONST_METHOD0(getColorXY, hueplusplus::XYBrightness());
MOCK_METHOD0(getColorXY, hueplusplus::XYBrightness());
MOCK_METHOD2(setColorRGB, bool(const hueplusplus::RGB& rgb, uint8_t transition));
MOCK_METHOD0(alert, bool());
MOCK_METHOD1(alertTemperature, bool(unsigned int mired));
MOCK_METHOD1(alertHueSaturation, bool(const hueplusplus::HueSaturation& hueSat));
MOCK_METHOD1(alertXY, bool(const hueplusplus::XYBrightness& xy));
MOCK_METHOD1(setColorLoop, bool(bool on));
MOCK_METHOD3(sendPutRequest,
nlohmann::json(const std::string& subPath, const nlohmann::json& request,hueplusplus::FileInfo fileInfo));
};
#endif