xorg-gtest  0.1
Xorg testing extension to Google Test
 All Classes Functions Pages
xorg::testing::Environment Class Reference

Global Google Test environment providing a dummy X server. More...

#include <xorg/gtest/environment.h>

Inheritance diagram for xorg::testing::Environment:

Public Member Functions

 Environment ()
 Constructs an object to provide a global X server dummy environment. More...
 
void set_log_file (const std::string &path_to_log_file)
 Sets the path where the server log file will be created. More...
 
const std::string & log_file () const
 Returns the path where the server log file will be created. More...
 
void set_conf_file (const std::string &path_conf_file)
 Sets the path to the desired server configuration file. More...
 
const std::string & conf_file () const
 Returns the path of the server configuration file to be used. More...
 
void set_server (const std::string &path_to_server)
 Sets the path to the server executable. More...
 
const std::string & server () const
 Returns the path of the server executable to be used. More...
 
void set_display (int display_num)
 Sets the display number that the server will use. More...
 
int display () const
 Returns the display number of the server instance. More...
 

Protected Member Functions

virtual void SetUp ()
 Starts the dummy X server. More...
 
virtual void TearDown ()
 Stops the dummy X server. More...
 

Detailed Description

Global Google Test environment providing a dummy X server.

Starts up a dummy X server for testing purposes. Either associate the environment manually with the overall testing framework like

environment->set_server("Xorg");
environment->set_display(133);
environment->set_conf_file("conf/dummy.conf");
environment->set_log_file("/tmp/MyDummyXorg.log");
testing::AddGlobalTestEnvironment(environment);

or link to libxorg-gtest_main.

Constructor & Destructor Documentation

xorg::testing::Environment::Environment ( )

Constructs an object to provide a global X server dummy environment.

Member Function Documentation

const std::string& xorg::testing::Environment::conf_file ( ) const

Returns the path of the server configuration file to be used.

Returns
File path of the server configuration currently set
int xorg::testing::Environment::display ( ) const

Returns the display number of the server instance.

Returns
Display number of the server.
const std::string& xorg::testing::Environment::log_file ( ) const

Returns the path where the server log file will be created.

Returns
Path to server logfile.
const std::string& xorg::testing::Environment::server ( ) const

Returns the path of the server executable to be used.

Returns
Path to server executable.
void xorg::testing::Environment::set_conf_file ( const std::string &  path_conf_file)

Sets the path to the desired server configuration file.

The path will be passed on to the server via the command line argument "-config". The default value is "[datadir]/xorg/gtest/dummy.conf".

Parameters
path_conf_filePath to a Xorg X server .conf file.
void xorg::testing::Environment::set_display ( int  display_num)

Sets the display number that the server will use.

The display number will be passed on to the server via the command line. The default value is 133.

Parameters
diplay_numA display number.
void xorg::testing::Environment::set_log_file ( const std::string &  path_to_log_file)

Sets the path where the server log file will be created.

The path will be passed on to the server via the command line argument "-logfile". The default value is "/tmp/Xorg.GTest.log".

Parameters
path_to_log_filePath to server logfile.
void xorg::testing::Environment::set_server ( const std::string &  path_to_server)

Sets the path to the server executable.

The default value is "Xorg".

Parameters
path_to_serverPath to an X.org server executable
virtual void xorg::testing::Environment::SetUp ( )
protectedvirtual

Starts the dummy X server.

Reimplemented from ::testing::Environment. See Google Test documentation for details.

Exceptions
std::runtime_errorif a dummy X server cannot be started.
Postcondition
If successful: subsequent connections to the dummy X server succeed.
If successful: Environment variable DISPLAY contains the display port for connecting to the dummy X server.
virtual void xorg::testing::Environment::TearDown ( )
protectedvirtual

Stops the dummy X server.

Reimplemented from ::testing::Environment. See Google Test documentation for details.

Postcondition
Dummy X server stopped.

The documentation for this class was generated from the following file: