Home < Documentation < Widget testingBack to CTK Documentation
Overview
Testing of both CTK widgets and application built on top of CTK could leverage the capabilities offered by the QtTesting library developed by Paraview folks.
How added the testing framework to CTK :
- Turn the variable CTK_USE_QTTESTING into ON.
If the option CTK_USE_QTTESTING is enabled, the build system will :
- Download external project QtTesting
- Compile the CTKQtTesting Library
- Including the class :
- ctkEventTranslaterPlayerWidget : Widget used by the Unit Test - Image
- ctkQtTestingUtility : Class used by the application - inherits from pqTestUtility
- ctkXMLEventObserver : Recover the Event and write the .xml file.
- ctkXMLEventSource : Read the .xml file and create the events.
- For CTKWidget - CTKVisualizationWidget - CTKCoreWidget :
- Include the event translator and player required for custom widgets. (Located in the same folder as their associated widget sources)
- If BUILD_TESTING is enabled: widgets EventTranslatorTests will be compiled.
- These tests will use ctkEventTranslaterPlayerWidget and ensure that events associated with widgets can be properly recorded and played.
Note:
Option CTK_USE_QTTESTING will be automatically enabled if BUILD_TESTING is ON
Adding the testing framework into your application
Adding the testing framework will allow users to recover script, but also a easy way to create tutorial or to test all the widget.
Follow these steps to add this testing framework to your application.
How
- ...
- ...
Limits
- ...
- ...
Issues found on QtTesting
- QSpinBox/QDoubleSpinBox :
- A long click on the up/down arrow -> just one click even if the value change severals times.
- Fast click -> Double click -> no effect.
- clik on the up/down arrow just after editing the spin Box -> no effect.
Solve : Contribution to the QtTesting by modified the pqSpinBoxEventTranslator - Push on my local branch -
- In pq3DView :
- The scroll button has no effect - Implemented for ctk.
- Shift between the current/Expected image.
Solve : new Implementation with the ctkVTKRenderViewEventTranslator and the ctkVTKRenderViewEventPlayer :
- Change the normalization into a normalization by the widget center.
- Implemented the scroll action
- Add a better rounded when we cast from double to int to not have shift issue.
- QComboBox when it is editable :
- The hight-event "set_sting" crash if we edit the comboBox.
- Exemple : If we have an item "foo", we are going to edit the comboBox with "f", but the item "f" doesn't exist, and the player will crash.
Solve : ...
Building
Milestones
- Integrate QtTesting has an external projects
- Add unit test to all the widget - Below, the summuray table -
- Implement ctkEventTranslaterPlayerWidget
- Create custom translator/player if needed
- Implement widgets EventTranslatorTests
- Create an Application test - ctkQtTesting -
Player/Translators Widget Testing
Summury table, to know each widgets' state.
The state can be Done : , Done with QtTesting issue : , in progress : , or without unit test: .
CTKWidgets
Widgets
|
State
|
Priority
|
Notes
|
ctkActionsWidget
|
|
|
|
ctkAddRemoveComboBox
|
|
|
|
ctkAxesWidget
|
|
|
Translator/player implemented
|
ctkBasePopupWidget
|
|
+++
|
ctkPopupWidget inherit of it. So we Test Directly ctkPopupWidget
|
ctkButtonGroup
|
|
|
|
ctkCheckableComboBox
|
|
+
|
minor issue with the currentText()
|
ctkCheckableHeaderView
|
|
++
|
more test ?
|
ctkCheckBoxPixmaps
|
|
--
|
Not used in Slicer
|
ctkCheckablePushButton
|
|
--
|
Not used in Slicer
|
ctkComboBox
|
|
|
|
ctkCompleter
|
|
-
|
|
ctkCollapsibleButton
|
|
|
|
ctkCollapsibleGroupBox
|
|
|
|
ctkColorDialog
|
|
|
QSpinBox issue if used
|
ctkColorPickerButton
|
|
|
QSpinBox issue if used
|
ctkConsole
|
|
|
May have a problem with the command
|
ctkConfirmExitDialog
|
|
-
|
|
ctkCoordinatesWidget
|
|
|
Problem with the QSpinBox
|
ctkCrosshairLabel
|
|
-
|
|
ctkDateRangeWidget
|
|
|
Problem with QDateTimer
|
ctkDirectoryButton
|
|
|
Value OK but no dialog
|
ctkDoubleRangeSlider
|
|
|
|
ctkDoubleSlider
|
|
|
|
ctkDynamicSpacer
|
|
-
|
|
ctkErrorLogStatusMessageHandler
|
|
---
|
Not a Widget
|
ctkErrorLogWidget
|
|
---
|
|
ctkExpandButton
|
|
|
|
ctkFileDialog
|
|
|
EventTranslator ?
|
ctkFittedTextBrowser
|
|
--
|
This widget just display text.
|
ctkFlowLayout
|
|
--
|
Layout are not tested through the event translator/player mechanism
|
ctkFontButton
|
|
|
QComboBox doesn't change the font
|
ctkIconEnginePlugin
|
|
--
|
Plugin are not tested through the event translator/player mechanism
|
ctkLayoutManager
|
|
|
|
ctkMaterialPropertyPreviewLabel
|
|
|
Not sure if something is requiered since it seems to be a label
|
ctkMaterialPropertyWidget
|
|
|
QSpinBox issue
|
ctkMatrixWidget
|
|
|
Skip all the visual effect
|
ctkMenuButton
|
|
|
Use in Slicer ? Implemented event translator/player
|
ctkMenuComboBox
|
|
+++
|
Issue if the subMenus have no parent
|
ctkModalityWidget
|
|
|
|
ctkPathLineEdit
|
|
++
|
Little issue with the listView for the fist show - As ctkMenuComboBox
|
ctkPixmapIconEngine
|
|
++
|
|
ctkPopupWidget
|
|
+
|
Implemented event translator/player
|
ctkQImageView
|
|
---
|
|
ctkRangeSlider
|
|
|
|
ctkRangeWidget
|
|
|
QDoubleSpinBox issue
|
ctkScreenshotDialog
|
|
-
|
|
ctkSearchBox
|
|
|
|
ctkSettings
|
|
+
|
Need a Test ?
|
ctkSettingsDialog
|
|
+
|
|
ctkSettingsPanel
|
|
+
|
It's a panel so doesn't need to be tested. However, is tested in ctkSettingsDialog testing
|
ctkSignalMapper
|
|
|
This object is not a widget and doesn't have to be tested through the event translator/player mechanism
|
ctkSimpleLayoutManager
|
|
|
|
ctkSliderWidget
|
|
|
QSpinBox Issue
|
ctkTestApplication
|
|
|
This is a utility class. Shouldn't be tested using the event translator/player mechanism
|
ctkThumbnailListWidget
|
|
--
|
|
ctkThumbnailWidget
|
|
--
|
|
ctkToolTipTrapper
|
|
|
This is a utility class. Shouldn't be tested using the event translator/player mechanism
|
ctkTransferFunctionBarsItem
|
|
-
|
|
ctkTransferFunctionControlPointsItem
|
|
-
|
|
ctkTransferFunctionGradientItem
|
|
-
|
|
ctkTransferFunctionItem
|
|
-
|
|
ctkTransferFunctionScene
|
|
-
|
|
ctkTransferFunctionView
|
|
-
|
|
ctkTreeComboBox
|
|
+
|
Good method ? - Spy count error
|
ctkWidgetsUtils
|
|
|
This is a utility class. Shouldn't be tested using the event translator/player mechanism
|
ctkWorkflowAbstractPagedWidget
|
|
-
|
|
ctkWorkflowButtonBoxWidget
|
|
-
|
|
ctkWorkflowGroupBox
|
|
-
|
|
ctkWorkflowStackedWidget
|
|
-
|
|
ctkWorkflowTabWidget
|
|
-
|
|
ctkWorkflowWidget
|
|
-
|
|
ctkWorkflowWidgetStep
|
|
-
|
|
|
CTKVisualizationVTKWidgets
Widgets
|
State
|
Priority
|
Notes
|
ctkVTKAbstractMatrixWidget
|
|
|
Tested in ctkVTKMatrixWidget
|
ctkVTKAbstractView
|
|
+++
|
Tested in ctkVTKRenderView
|
ctkVTKChartView
|
|
|
|
ctkVTKDataSetArrayComboBox
|
|
|
|
ctkVTKDataSetModel
|
|
|
|
ctkVTKMagnifyView
|
|
-
|
|
ctkVTKMatrixWidget
|
|
|
use ctkMatrixWidget translator & player
|
ctkVTKRenderView
|
|
+++
|
Translator/Player implemented What we want : - Wheel event - Better normalization - Not working if the renderView has a different size
|
ctkVTKScalarBarWidget
|
|
|
QSpinBox issue + key "."(pad) on the line edit
|
ctkVTKScalarsToColorsUtils
|
|
|
|
ctkVTKScalarsToColorsView
|
|
|
|
ctkVTKScalarsToColorsWidget
|
|
|
|
ctkVTKSliceView
|
|
+++
|
may use the ctkVTKRenderView translator & player
|
ctkVTKSurfaceMaterialPropertyWidget
|
|
|
|
ctkVTKTextPropertyWidget
|
|
|
|
ctkVTKThresholdWidget
|
|
|
|
ctkVTKThumbnailView
|
|
|
|
ctkVTKVolumePropertyWidget
|
|
|
|
ctkVTKWidgetsUtils
|
|
|
|
CTKDICOMWidgets
Widgets
|
State
|
Priority
|
Notes
|
ctkDICOMAppWidget
|
|
|
|
ctkDICOMDatasetView
|
|
|
|
ctkDICOMDirectoryListWidget
|
|
|
|
ctkDICOMImage
|
|
|
|
ctkDICOMImportWidget
|
|
|
|
ctkDICOMItemTreeModel
|
|
|
|
ctkDICOMListenerWidget
|
|
|
|
ctkDICOMQueryResultsTabWidget
|
|
|
|
ctkDICOMQueryRetrieveWidget
|
|
|
|
ctkDICOMQueryWidget
|
|
|
|
ctkDICOMServerNodeWidget
|
|
|
|
ctkDICOMThumbnailGenerator
|
|
|
|
ctkDICOMThumbnailListWidget
|
|
|
|
|
Screenshots
Simple application with recording / playing Qt testing capabilities
Little exemple of the widget testing