QTestFixture.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 
18 #ifndef _QTESTFIXTURE_HH_
19 #define _QTESTFIXTURE_HH_
20 
21 #include <string>
22 
23 #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
24 # include <boost/thread.hpp>
25 # include "gazebo/Server.hh"
26 # include "gazebo/physics/physics.hh"
27 # include "gazebo/rendering/rendering.hh"
28 #endif
29 
30 #include "gazebo/gui/qt.h"
31 #include "gazebo/gui/qt_test.h"
32 
33 #include "gazebo/gazebo_config.h"
34 #include "test_config.h"
35 
37 class QTestFixture : public QObject
38 {
39  Q_OBJECT
40 
41  public: QTestFixture();
42 
48  protected: void Load(const std::string &_worldFilename, bool _paused = false,
49  bool _serverScene = true, bool _clientScene = false);
50 
53  protected: void SetPause(bool _pause);
54 
58  protected: void GetMemInfo(double &_resident, double &_share);
59 
62  private slots: void initTestCase();
63 
65  private slots: void init();
66 
68  private slots: void cleanup();
69 
71  private slots: void cleanupTestCase();
72 
77  private: void RunServer(const std::string &_worldFilename, bool _paused,
78  bool _createScene);
79 
81  protected: gazebo::Server *server;
82 
84  protected: boost::thread *serverThread;
85 
87  protected: double resMaxPercentChange;
88 
90  protected: double shareMaxPercentChange;
91 
93  private: double residentStart;
94 
96  private: double shareStart;
97 };
98 #endif
gazebo::Server * server
The Gazebo server, which is run in a thread.
Definition: QTestFixture.hh:81
void Load(const std::string &_worldFilename, bool _paused=false, bool _serverScene=true, bool _clientScene=false)
Load a world.
Base class for all Gazebo GUI unit tests.
Definition: QTestFixture.hh:37
double resMaxPercentChange
Maximum allowed percent change in resident memory usage.
Definition: QTestFixture.hh:87
void GetMemInfo(double &_resident, double &_share)
Get memory information about the current process.
Definition: Server.hh:45
void SetPause(bool _pause)
Pause or unpause the world.
boost::thread * serverThread
Thread to run the Gazebo server.
Definition: QTestFixture.hh:84
double shareMaxPercentChange
Maximum allowed percent change in shared memory usage.
Definition: QTestFixture.hh:90