From 4e0d1197da464253aa323118b73add41aed72a38 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 21 Apr 2022 13:08:50 +0200 Subject: [PATCH 1/2] handling of devicePixelratio for pixmaps fixed --- src/graphic/QskGraphic.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/graphic/QskGraphic.cpp b/src/graphic/QskGraphic.cpp index 8355107b..7280c935 100644 --- a/src/graphic/QskGraphic.cpp +++ b/src/graphic/QskGraphic.cpp @@ -781,8 +781,8 @@ QPixmap QskGraphic::toPixmap( qreal devicePixelRatio ) const const QSizeF sz = defaultSize(); - const int w = qCeil( sz.width() ); - const int h = qCeil( sz.height() ); + const int w = qCeil( sz.width() * devicePixelRatio ); + const int h = qCeil( sz.height() * devicePixelRatio ); QPixmap pixmap( w, h ); pixmap.setDevicePixelRatio( devicePixelRatio ); @@ -803,7 +803,10 @@ QPixmap QskGraphic::toPixmap( const QSize& size, if ( devicePixelRatio <= 0.0 ) devicePixelRatio = qskDevicePixelRatio(); - QPixmap pixmap( size ); + const int w = qCeil( size.width() * devicePixelRatio ); + const int h = qCeil( size.height() * devicePixelRatio ); + + QPixmap pixmap( w, h ); pixmap.setDevicePixelRatio( devicePixelRatio ); pixmap.fill( Qt::transparent ); @@ -822,7 +825,10 @@ QImage QskGraphic::toImage( const QSize& size, if ( devicePixelRatio <= 0.0 ) devicePixelRatio = qskDevicePixelRatio(); - QImage image( size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied ); + const int w = qCeil( size.width() * devicePixelRatio ); + const int h = qCeil( size.height() * devicePixelRatio ); + + QImage image( w, h, QImage::Format_ARGB32_Premultiplied ); image.setDevicePixelRatio( devicePixelRatio ); image.fill( 0 ); @@ -845,8 +851,8 @@ QImage QskGraphic::toImage( qreal devicePixelRatio ) const const QSizeF sz = defaultSize(); - const int w = qCeil( sz.width() ) * devicePixelRatio; - const int h = qCeil( sz.height() ) * devicePixelRatio; + const int w = qCeil( sz.width() * devicePixelRatio ); + const int h = qCeil( sz.height() * devicePixelRatio ); QImage image( w, h, QImage::Format_ARGB32 ); image.setDevicePixelRatio( devicePixelRatio ); From 0e6522a4afd93ae652f1ce977e14942a43ec765a Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 22 Apr 2022 07:31:49 +0200 Subject: [PATCH 2/2] CI: Add smoke testing (#186) --- .github/workflows/qmake.yml | 131 ++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/.github/workflows/qmake.yml b/.github/workflows/qmake.yml index cc35815a..5c0ae097 100644 --- a/.github/workflows/qmake.yml +++ b/.github/workflows/qmake.yml @@ -7,9 +7,12 @@ on: branches: [ master ] jobs: + build-linux-qt5-15: name: Linux Qt 5.15 build runs-on: ubuntu-latest + env: + DISPLAY: ":1" steps: - uses: actions/checkout@v2 - name: Cache Qt @@ -42,10 +45,32 @@ jobs: run: qmake qskinny.pro - name: make run: make -j$(nproc) + - name: Smoke test + run: | + echo starting Xvfb + Xvfb :1 & + sleep 10 + echo starting iotdashboard + ./examples/bin/iotdashboard & + sleep 10 + echo taking screenshot + import -pause 1 -window root screenshot-linux-qt5-15.jpg + echo killing iotdashboard + killall iotdashboard + echo killing Xvfb + killall Xvfb + - name: Upload smoke test artifacts + uses: actions/upload-artifact@v2 + with: + name: screenshot-linux-qt5-15.jpg + path: screenshot-linux-qt5-15.jpg + build-linux-qt-lts: name: Linux Qt 6.2 (LTS) build runs-on: ubuntu-latest + env: + DISPLAY: ":1" steps: - uses: actions/checkout@v2 - name: Cache Qt @@ -80,10 +105,32 @@ jobs: run: qmake qskinny.pro - name: make run: make -j$(nproc) + - name: Smoke test + run: | + echo starting Xvfb + Xvfb :1 & + sleep 10 + echo starting gallery + ./examples/bin/gallery & + sleep 10 + echo taking screenshot + import -pause 1 -window root screenshot-linux-qt6-2.jpg + echo killing gallery + killall gallery + echo killing Xvfb + killall Xvfb + - name: Upload smoke test artifacts + uses: actions/upload-artifact@v2 + with: + name: screenshot-linux-qt6-2.jpg + path: screenshot-linux-qt6-2.jpg + build-linux-qt-current: name: Linux Qt 6.3 (current) build runs-on: ubuntu-latest + env: + DISPLAY: ":1" steps: - uses: actions/checkout@v2 - name: Cache Qt @@ -118,6 +165,26 @@ jobs: run: qmake qskinny.pro - name: make run: make -j$(nproc) + - name: Smoke test + run: | + echo starting Xvfb + Xvfb :1 & + sleep 10 + echo starting gallery + ./examples/bin/gallery & + sleep 10 + echo taking screenshot + import -pause 1 -window root screenshot-linux-qt6-3.jpg + echo killing gallery + killall gallery + echo killing Xvfb + killall Xvfb + - name: Upload smoke test artifacts + uses: actions/upload-artifact@v2 + with: + name: screenshot-linux-qt6-3.jpg + path: screenshot-linux-qt6-3.jpg + build-windows-qt5-15: name: Windows Qt 5.15 build @@ -161,6 +228,18 @@ jobs: Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip unzip jom.zip .\jom + - name: Smoke test + run: | + $Env:PATH += ";lib;plugins\skins" + echo "starting iotdashboard" + Start-Process .\examples\bin\iotdashboard + Start-Sleep -s 10 + - uses: OrbitalOwen/desktop-screenshot-action@0.1 + with: + file-name: 'screenshot-windows-qt5-15.jpg' + - name: Cleanup smoke test + run: taskkill /IM iotdashboard.exe /T + build-windows-qt-lts: name: Windows Qt 6.2 (LTS) build @@ -204,6 +283,18 @@ jobs: Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip unzip jom.zip .\jom + - name: Smoke test + run: | + $Env:PATH += ";lib;plugins\skins" + echo "starting gallery" + Start-Process .\examples\bin\gallery + Start-Sleep -s 10 + - uses: OrbitalOwen/desktop-screenshot-action@0.1 + with: + file-name: 'screenshot-windows-qt6-2.jpg' + - name: Cleanup smoke test + run: taskkill /IM gallery.exe /T + build-windows-qt-current: name: Windows Qt 6.3 (current) build @@ -247,6 +338,18 @@ jobs: Invoke-WebRequest -Uri "https://download.qt.io/official_releases/jom/jom.zip" -OutFile jom.zip unzip jom.zip .\jom + - name: Smoke test + run: | + $Env:PATH += ";lib;plugins\skins" + echo "starting gallery" + Start-Process .\examples\bin\gallery + Start-Sleep -s 10 + - uses: OrbitalOwen/desktop-screenshot-action@0.1 + with: + file-name: 'screenshot-windows-qt6-3.jpg' + - name: Cleanup smoke test + run: taskkill /IM gallery.exe /T + build-mac-qt5-15: name: MacOS Qt 5.15 build @@ -283,6 +386,16 @@ jobs: run: qmake qskinny.pro - name: make run: make -j$(sysctl -n hw.ncpu) + - name: Smoke test + run: | + DYLD_LIBRARY_PATH=./lib ./examples/bin/iotdashboard.app/Contents/MacOS/iotdashboard -qwindowgeometry 1024x600+75+100 & + sleep 10 + - uses: OrbitalOwen/desktop-screenshot-action@0.1 + with: + file-name: 'screenshot-macos-qt5-15.jpg' + - name: Cleanup smoke test + run: killall iotdashboard + build-mac-qt-lts: name: MacOS Qt 6.2 (LTS) build @@ -319,6 +432,15 @@ jobs: run: qmake qskinny.pro - name: make run: make -j$(sysctl -n hw.ncpu) + - name: Smoke test + run: | + DYLD_LIBRARY_PATH=./lib ./examples/bin/gallery.app/Contents/MacOS/gallery -qwindowgeometry 1024x600+75+100 & + sleep 10 + - uses: OrbitalOwen/desktop-screenshot-action@0.1 + with: + file-name: 'screenshot-macos-qt6-2.jpg' + - name: Cleanup smoke test + run: killall gallery build-mac-qt-current: name: MacOS Qt 6.3 (current) build @@ -355,3 +477,12 @@ jobs: run: qmake qskinny.pro - name: make run: make -j$(sysctl -n hw.ncpu) + - name: Smoke test + run: | + DYLD_LIBRARY_PATH=./lib ./examples/bin/gallery.app/Contents/MacOS/gallery -qwindowgeometry 1024x600+75+100 & + sleep 10 + - uses: OrbitalOwen/desktop-screenshot-action@0.1 + with: + file-name: 'screenshot-macos-qt6-3.jpg' + - name: Cleanup smoke test + run: killall gallery