void tst_QSystemDisplayInfo::tst_contrast() { QSystemDisplayInfo di; QVERIFY((di.contrast(0) >= 0 && di.contrast(0)< 1.0) || di.contrast(0) == -1); // contrast levels are between 0 and 1.0 }
static void test_systemdisplayinfo(void) { QSystemDisplayInfo displayinfo; QDesktopWidget wid; for( int display = 0; display < wid.screenCount(); ++display ) { qDebug() << ""; qDebug() << "Display:" << display; int depth = displayinfo.colorDepth(display); qDebug() << " displayinfo.colorDepth() ->" << depth; int value = displayinfo.displayBrightness(display); qDebug() << " displayinfo.displayBrightness() ->" << value; QSystemDisplayInfo::DisplayOrientation orientation = displayinfo.orientation(display); qDebug() << " displayinfo.orientation() ->" << orientation; float contrast = displayinfo.contrast(display); qDebug() << " displayinfo.getContrast() ->" << contrast; int dpiWidth = displayinfo.getDPIWidth(display); qDebug() << " displayinfo.getDPIWidth() ->" << dpiWidth; int dpiHeight = displayinfo.getDPIHeight(display); qDebug() << " displayinfo.getDPIHeight() ->" << dpiHeight; int physicalHeight = displayinfo.physicalHeight(display); qDebug() << " displayinfo.physicalHeight() ->" << physicalHeight; int physicalWidth = displayinfo.physicalWidth(display); qDebug() << " displayinfo.physicalWidth() ->" << physicalWidth; QSystemDisplayInfo::BacklightState state = displayinfo.backlightStatus(display); qDebug() << " displayinfo.backlightStatus() ->" << state; } }
void Dialog::setupDisplay() { QSystemDisplayInfo di; brightnessLineEdit->setText(QString::number(di.displayBrightness(0))); colorDepthLineEdit->setText(QString::number(di.colorDepth((0)))); }
void tst_QSystemDisplayInfo::tst_orientation() { QSystemDisplayInfo::DisplayOrientation orient = QSystemDisplayInfo::Unknown; QSystemDisplayInfo di; orient = di.orientation(0); QRect availableGeometry = QApplication::desktop()->availableGeometry(0); if(availableGeometry.width() > availableGeometry.height()) { QVERIFY(orient == QSystemDisplayInfo::Landscape || orient == QSystemDisplayInfo::InvertedLandscape); } else { QVERIFY(orient == QSystemDisplayInfo::Portrait || orient == QSystemDisplayInfo::InvertedPortrait); } }
void tst_QSystemDisplayInfo::tst_colorDepth() { QSystemDisplayInfo di; int depth = di.colorDepth(0); QDesktopWidget wid; if(wid.screenCount() > 1) { QVERIFY(depth == 0 || depth == 8 || depth == 16 || depth == 24 || depth == 32 || depth == 64); } QVERIFY(di.colorDepth(999) == -1); }
void tst_QSystemDisplayInfo::tst_displayBrightness() { QSystemDisplayInfo di; QVERIFY(di.displayBrightness(0) > -2); QVERIFY(di.displayBrightness(999) == -1); }
void tst_QSystemDisplayInfo::tst_physicalWidth() { QSystemDisplayInfo di; QVERIFY(di.physicalWidth(0) > -1); }
void tst_QSystemDisplayInfo::tst_physicalHeight() { QSystemDisplayInfo di; QVERIFY(di.physicalHeight(0) > -1); }
void tst_QSystemDisplayInfo::tst_getDPIHeight() { QSystemDisplayInfo di; QVERIFY(di.getDPIHeight(0) > -1); }
void tst_QSystemDisplayInfo::tst_getDPIWidth() { QSystemDisplayInfo di; QVERIFY(di.getDPIWidth(0) > -1); }