Documentation/Widget testing

From Commontk
Revision as of 15:29, 25 November 2011 by Benjamin.long (talk | contribs) (Overview)
Jump to navigationJump to search

Back 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 :

  1. Download external project QtTesting
  2. Compile the CTKQtTesting Library
    • Including the class :
      • ctkEventTranslaterPlayerWidget : Widget used by the Unit Test
      • 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.
  3. For CTKWidget - CTKVisualizationWidget - CTKCoreWidget :
    • Include the event translator and player required for custom widgets. (Located in the same folder as their associated widget sources)
  4. 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.


How added the testing framework into your application if you're using CTK :

  • Milestones :""
    1. ...
    2. ...


Note Note:
Option CTK_USE_QTTESTING will be automatically enabled if BUILD_TESTING is ON

Milestones

  1. Integrate QtTesting has an external projects
  2. Add unit test to all the widget - Below, the summuray table -
    1. Implement ctkEventTranslaterPlayerWidget
    2. Create custom translator/player if needed
    3. Implement widgets EventTranslatorTests
  3. Create an Application test - ctkQtTesting -

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 :

  1. Change the normalization into a normalization by the widget center.
  2. Implemented the scroll action
  3. 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 : ...

Screenshots

Player/Translators Widget Testing

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
- Record the widget size
- Resize the view before the playback
- Add QMessageBox to prevent the user - BUG -
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