From 144193549a3a47ea3ade74289e3adc55c2bd65e6 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 6 Sep 2019 16:13:30 +0200 Subject: lancelot graphics test: Fix screengrabs being distorted on Windows The grabbing process transports the image data to the main process over the stdout stream. Windows by default applies LF->CRLF conversion on that stream. Avoid by setting the binary mode flag on it. Change-Id: Ieec0911e24e21c111caeb35e35259833e1fdd639 Reviewed-by: Laszlo Agocs Reviewed-by: Andy Nichols --- tests/manual/scenegraph_lancelot/scenegrabber/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/manual/scenegraph_lancelot') diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp index 6da0799bbc..23c678380c 100644 --- a/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp +++ b/tests/manual/scenegraph_lancelot/scenegrabber/main.cpp @@ -36,6 +36,11 @@ #include #include +#ifdef Q_OS_WIN +# include +# include +#endif // Q_OS_WIN + // Timeout values: // A valid screen grab requires the scene to not change @@ -101,6 +106,10 @@ private slots: #endif if (ofile == "-") { // Write to stdout QFile of; +#ifdef Q_OS_WIN + // Make sure write to stdout doesn't do LF->CRLF + _setmode(_fileno(stdout), _O_BINARY); +#endif // Q_OS_WIN if (!of.open(1, QIODevice::WriteOnly) || !lastGrab.save(&of, "ppm")) { qWarning() << "Error: failed to write grabbed image to stdout."; QGuiApplication::exit(2); -- cgit v1.2.3