File: testhelpers.cc

package info (click to toggle)
dspdfviewer 1.15.1%2Bgit20230427.d432d8d-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 924 kB
  • sloc: cpp: 2,303; makefile: 22; sh: 7
file content (20 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "testhelpers.hh"

#include <QDir>

QString TestHelpers::pdfFilename(const std::string& basename) {
	const QString relativePart = QString::fromLocal8Bit( basename.c_str() );
	const QDir myDir = QDir::current();
	if ( ! myDir.exists(relativePart) ) {
		throw std::runtime_error("Could not find the test pdf. This is bad.");
	}
	return myDir.filePath(relativePart);
}

std::ostream& operator << (std::ostream& where, const QSize& what) {
	return where << "QSize(" << what.width() << 'x' << what.height() << ')';
}

std::ostream& operator << (std::ostream& where, const QColor& what) {
	return where << "QColor(" << qPrintable( what.name() ) << ")";
}