summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPovilas Kanapickas <povilas@radix.lt>2020-12-09 22:04:11 +0200
committerPovilas Kanapickas <povilas@radix.lt>2020-12-14 15:35:35 +0200
commit0ad6db6b966981e94c6ca0a8afba5a4996a68a70 (patch)
tree87e0b87d7b1497322f7d85d2b120c82c505634f7 /tests
parent861ad1a8fe37f43f7cf25737672cf6b8ab7cadc1 (diff)
Add a way to append config to server layout
Diffstat (limited to 'tests')
-rw-r--r--tests/common/xorg-conf.cpp7
-rw-r--r--tests/common/xorg-conf.h11
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/common/xorg-conf.cpp b/tests/common/xorg-conf.cpp
index aa1359c..5fb716c 100644
--- a/tests/common/xorg-conf.cpp
+++ b/tests/common/xorg-conf.cpp
@@ -69,6 +69,8 @@ void XOrgConfig::WriteConfig(const std::string &path) {
conffile << " Screen 0 \"" << default_device << " screen\" 0 0\n";
for (it = input_devices.begin(); it != input_devices.end(); it++)
conffile << " InputDevice \"" << *it << "\"\n";
+ for (it = server_layout_opts.begin(); it != server_layout_opts.end(); ++it)
+ conffile << *it << "\n";
conffile << "EndSection\n";
}
@@ -105,6 +107,11 @@ void XOrgConfig::AddDefaultScreenWithDriver(const std::string &driver,
sections.push_back(section.str());
}
+void XOrgConfig::AddServerLayoutOption(const std::string& option)
+{
+ server_layout_opts.push_back(option);
+}
+
void XOrgConfig::AddInputSection(const std::string &driver,
const std::string &identifier,
const std::string &options,
diff --git a/tests/common/xorg-conf.h b/tests/common/xorg-conf.h
index d6e8836..6e8ed67 100644
--- a/tests/common/xorg-conf.h
+++ b/tests/common/xorg-conf.h
@@ -87,6 +87,16 @@ public:
virtual void RemoveConfig();
/**
+ * Add an option to the server layout.
+ * Options may be specified by the caller and must be a single string.
+ * It is recommened that multiple options are separated by line-breaks
+ * to improve the readability of the config file.
+ *
+ * @param option Option in the form "<option name> <values>"
+ */
+ void AddServerLayoutOption(const std::string& option);
+
+ /**
* Add a Section InputDevice to the config file. This section is
* optionally referenced from the ServerLayout written by this section,
* and in the form of:
@@ -178,6 +188,7 @@ protected:
std::string config_file;
std::vector<std::string> sections;
std::vector<std::string> input_devices;
+ std::vector<std::string> server_layout_opts;
std::string default_device;
bool auto_add_devices;
};