-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
416cf0f
commit 881ff67
Showing
15 changed files
with
121 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[run] | ||
omit = | ||
IQM_Vis/examples/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,5 @@ pydata-sphinx-theme | |
sphinx-book-theme | ||
cloud-sptheme | ||
Jinja2==3.0 | ||
genbadge | ||
packaging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[pytest] | ||
; addopts = --maxfail=3 --tb=short -p no:xdist -s | ||
qt_api=pyqt6 | ||
addopts=--forked | ||
addopts=--forked --cov=IQM_Vis --junitxml=tests/reports/junit/junit.xml | ||
; --numprocesses=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/bash | ||
# Author: Matt Clifford <[email protected]> | ||
# License: BSD 3-Clause License | ||
|
||
pytest | ||
genbadge tests --input-file tests/reports/junit/junit.xml --output-file tests/reports/tests_badge.svg | ||
coverage xml -o tests/reports/coverage/coverage.xml | ||
genbadge coverage --input-file tests/reports/coverage/coverage.xml --output-file tests/reports/coverage_badge.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Author: Matt Clifford <[email protected]> | ||
# License: BSD 3-Clause License | ||
|
||
import pytest | ||
from PyQt6 import QtTest, QtWidgets, QtCore | ||
from pytestqt.plugin import QtBot | ||
import IQM_Vis | ||
|
||
|
||
def get_UI(): | ||
image1 = IQM_Vis.examples.images.IMAGE1 | ||
image2 = IQM_Vis.examples.images.IMAGE2 | ||
images = [image1, image2] | ||
|
||
MAE = IQM_Vis.metrics.MAE() | ||
MSE = IQM_Vis.metrics.MSE() | ||
SSIM = IQM_Vis.metrics.SSIM() | ||
|
||
metrics = {'MAE': MAE, | ||
'MSE': MSE, | ||
'1-SSIM': SSIM} | ||
|
||
MSE_image = IQM_Vis.metrics.MSE(return_image=True) | ||
SSIM_image = IQM_Vis.metrics.SSIM(return_image=True) | ||
metric_images = {'MSE': MSE_image, | ||
'1-SSIM': SSIM_image} | ||
|
||
rotation = IQM_Vis.transforms.rotation | ||
blur = IQM_Vis.transforms.blur | ||
brightness = IQM_Vis.transforms.brightness | ||
jpeg_compression = IQM_Vis.transforms.jpeg_compression | ||
|
||
transformations = { | ||
# normal input | ||
'rotation': {'min': -180, 'max': 180, 'function': rotation}, | ||
# only odd ints since it's a kernel | ||
'blur': {'min': 1, 'max': 41, 'function': blur, 'normalise': 'odd'}, | ||
# float values | ||
'brightness': {'min': -1.0, 'max': 1.0, 'function': brightness}, | ||
# non zero inital value | ||
'jpg comp.': {'min': 1, 'max': 100, 'function': jpeg_compression, 'init_value': 100}, | ||
} | ||
|
||
test_app = IQM_Vis.make_UI(transformations=transformations, | ||
image_list=images, | ||
metrics=metrics, | ||
metric_images=metric_images, | ||
test=True) | ||
return test_app | ||
|
||
|
||
# building and closing function of UI for testing | ||
@pytest.fixture(scope='function') | ||
def build_IQM_Vis(): | ||
# QtTest.QTest.qWait(5000) | ||
# Setup | ||
test_window = get_UI() | ||
qtbotbis = QtBot(test_window.window) | ||
|
||
yield test_window, qtbotbis | ||
|
||
# Clean up | ||
QtTest.QTest.qWait(100) | ||
|
||
# need to handle the closing dialog | ||
def handle_dialog(): | ||
messagebox = QtWidgets.QApplication.activeWindow() | ||
yes_button = messagebox.button( | ||
QtWidgets.QMessageBox.StandardButton.Yes) | ||
qtbotbis.mouseClick( | ||
yes_button, QtCore.Qt.MouseButton.LeftButton, delay=1) | ||
|
||
QtCore.QTimer.singleShot(100, handle_dialog) | ||
|
||
# test_window.window.quit() | ||
test_window.window.main.close() | ||
# QtTest.QTest.qWait(5000) | ||
|
||
|
||
def test_sliders(build_IQM_Vis): | ||
test_window, qtbotbis = build_IQM_Vis | ||
assert test_window.showing == True |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="13" time="19.434" timestamp="2024-10-09T11:25:38.954759" hostname="Dell-5320"><testcase classname="tests.test_metrics" name="test_all_metrics_initialise" time="0.221" /><testcase classname="tests.test_metrics" name="test_all_metrics_images_initialise" time="0.236" /><testcase classname="tests.test_metrics" name="test_all_metrics_process_image" time="1.950" /><testcase classname="tests.test_metrics" name="test_all_metric_images_process_image" time="0.251" /><testcase classname="tests.test_transforms" name="test_all_transforms_init_value_no_change_image" time="0.237" /><testcase classname="tests.test_transforms" name="test_all_transforms_min_max_specified" time="0.234" /><testcase classname="tests.test_transforms" name="test_all_transforms_min_change_image" time="0.269" /><testcase classname="tests.test_transforms" name="test_all_transforms_max_change_image" time="0.328" /><testcase classname="tests.UI.test_sliders" name="test_sliders" time="1.310" /><testcase classname="tests.notebook_examples.test_1_making_the_UI" name="test_build_1" time="1.030" /><testcase classname="tests.notebook_examples.test_2_simple_customisation" name="test_build_2" time="1.180" /><testcase classname="tests.notebook_examples.test_3_customisation_details" name="test_3" time="3.010" /><testcase classname="tests.notebook_examples.test_4_experiment" name="test_experiment_runs" time="6.186" /></testsuite></testsuites> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.