MCPcopy Create free account
hub / github.com/Blizzard/s2client-api / TestCameraMove

Class TestCameraMove

tests/test_feature_layer.cc:178–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176//
177
178class TestCameraMove : public TestSequence {
179public:
180 Point2DI camera_pos_;
181
182 void OnTestStart() override {
183 ActionFeatureLayerInterface* action = agent_->ActionsFeatureLayer();
184
185 const GameInfo& game_info = agent_->Observation()->GetGameInfo();
186
187 const float kRandomOffset = 10.0f;
188
189 Point2D test_point = FindCenterOfMap(game_info);
190 test_point.x += GetRandomScalar() * kRandomOffset;
191 test_point.y += GetRandomScalar() * kRandomOffset;
192
193 camera_pos_ = ConvertWorldToMinimap(game_info, test_point);
194 action->CameraMove(camera_pos_);
195
196 wait_game_loops_ = 5;
197 }
198
199 void OnStep() override {
200
201 }
202
203 void OnTestFinish() override {
204 const GameInfo& game_info = agent_->Observation()->GetGameInfo();
205 Point2D camera_world = agent_->Observation()->GetCameraPos();
206 Point2DI camera = ConvertWorldToMinimap(game_info, camera_world);
207
208 if (camera.x != camera_pos_.x || camera.y != camera_pos_.y) {
209 ReportError("Camera not at expected location");
210 }
211 }
212};
213
214class UnitCommandsFeatureLayer : public TestSequence {
215public:

Callers 1

FeatureLayerTestBotMethod · 0.85

Calls

no outgoing calls

Tested by 1

FeatureLayerTestBotMethod · 0.68