ArchitectureColoredPainting/UnitTest/EPaperTest.cpp

37 lines
822 B
C++

#include "EPaperTest.h"
#include "CppUnitTest.h"
#include <QApplication>
#include <QWidget>
#include <qlabel.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTest
{
TEST_CLASS(EPaperTest)
{
private:
char* argv[1];
int argc;
public:
EPaperTest() :argv{ (char*)"" }, argc(1) {}
TEST_METHOD(TestBothSidesRound)
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication a(argc, argv);
QLabel w;
w.setFixedSize({296,128});
QImage image(QSize(296, 128), QImage::Format_RGB32);
image.fill(Qt::red);
w.setPixmap(QPixmap::fromImage(image));
w.show();
a.exec();
}
};
}