From da88e53621581fa84bf014cca0cb63b417bb131b Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Tue, 20 Oct 2015 16:56:42 +0300 Subject: tests/testpat: Add -m flag --- tests/testpat.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/testpat.cpp b/tests/testpat.cpp index 52e9713..13fea9e 100644 --- a/tests/testpat.cpp +++ b/tests/testpat.cpp @@ -4,13 +4,19 @@ #include "kms++.h" #include "test.h" +#include "cmdoptions.h" using namespace std; using namespace kms; -int main() +static map options = { + { "m", HAS_PARAM("Set display mode, for example 1920x1080") }, +}; + +int main(int argc, char **argv) { Card card; + CmdOptions opts(argc, argv, options); if (card.master() == false) printf("Not DRM master, modeset may fail\n"); @@ -30,6 +36,9 @@ int main() auto mode = conn->get_default_mode(); + if (opts.is_set("m")) + mode = conn->get_mode(opts.opt_param("m")); + auto fb = new DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, PixelFormat::XRGB8888); draw_test_pattern(*fb); fbs.push_back(fb); -- cgit v1.2.3