Ignition Gazebo

API Reference

5.1.0
TestFixture.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGNITION_GAZEBO_TESTFIXTURE_HH_
18 #define IGNITION_GAZEBO_TESTFIXTURE_HH_
19 
20 #include <memory>
21 #include <string>
22 
24 #include "ignition/gazebo/Export.hh"
27 
28 namespace ignition
29 {
30 namespace gazebo
31 {
32 // Inline bracket to help doxygen filtering.
33 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
34 //
35 class IGNITION_GAZEBO_HIDDEN TestFixturePrivate;
55 class IGNITION_GAZEBO_VISIBLE TestFixture
56 {
59  public: explicit TestFixture(const std::string &_path);
60 
63  public: explicit TestFixture(const ServerConfig &_config);
64 
66  public: virtual ~TestFixture();
67 
72  public: TestFixture &OnConfigure(std::function<void(
73  const Entity &_entity,
76  EventManager &_eventMgr)> _cb);
77 
81  public: TestFixture &OnPreUpdate(std::function<void(
82  const UpdateInfo &, EntityComponentManager &)> _cb);
83 
87  public: TestFixture &OnUpdate(std::function<void(
88  const UpdateInfo &, EntityComponentManager &)> _cb);
89 
93  public: TestFixture &OnPostUpdate(std::function<void(
94  const UpdateInfo &, const EntityComponentManager &)> _cb);
95 
100  public: TestFixture &Finalize();
101 
103  public: std::shared_ptr<gazebo::Server> Server() const;
104 
107  // TODO(chapulina) Use IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr) when porting to v6
108  private: TestFixturePrivate *dataPtr;
109 };
110 }
111 }
112 }
113 #endif
The server instantiates and controls simulation.
Definition: Server.hh:108
Configuration parameters for a Server. An instance of this object can be used to construct a Server w...
Definition: ServerConfig.hh:43
Helper class to write automated tests. It provides a convenient API to load a world file...
Definition: TestFixture.hh:55
Information passed to systems on the update callback.
Definition: Types.hh:36
STL class.
The EntityComponentManager constructs, deletes, and returns components and entities. A component can be of any class which inherits from components::BaseComponent.
Definition: EntityComponentManager.hh:65
class IGNITION_GAZEBO_HIDDEN TestFixturePrivate
Definition: TestFixture.hh:35
The EventManager is used to send/receive notifications of simulator events.
Definition: EventManager.hh:54
This library is part of the Ignition Robotics project.
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light. At its core, an Entity is just an identifier.
Definition: Entity.hh:59