Projects:ARRA:VTKWidgetsTesting
Preliminary Steps
Working from the Slicer3 VTK56 git repository.
First goal is to set up a similar infrastructure as used in Slicer3/Libs/MRML/Testing, which includes a file that defines basic testing macros (Slicer3/TestingMacros.h) that calls methods on super classes and chains macros together as you get down to testing subclasses. The file
VTK/Widgets/Testing/Cxx/WidgetTestingMacros.h
is set up to define:
EXERCISE_BASIC_OBJECT_METHODS (copied from Slicer, thanks to Luis Ibanez) TEST_SET_GET for various variable types (INT, BOOLEAN, STRING, DOUBLE, VECTOR3, CHAR) EXERCISE_BASIC_INTERACTOR_OBSERVER_METHODS for the superclass (could be moved/copied to VTK/Rendering/Testing, no tests yet) EXERCISE_BASIC_ABSTRACT_METHODS EXERCISE_BASIC_BORDER_METHODS to test widgets that inherit from vtkBorderWidget (Text) EXERCISE_BASIC_HOVER_METHOD to test widgets that inherit from vtkHoverWidget (Balloon)
Then new testing .cxx files were crafted and added to the CMakeLists.txt to use these basic macros to test every call.
Then extend it to exercise basic prop, widget representation, border representation methods once get to testing the widget representations.
WORK IN PROGRESS
Widgets
Notes made while writing the Widget tests: (priorities taken from here: Priority Widgets, indentation shows inheritance)
- vtkInteractorObserver defines the Enabled variable and the On/Off methods. Testing them in isolation shows that there are missing checks for having an interactor defined, as the test crashes consistently even after creating a render window and interactor to pass to the widget
- vtkAbstractWidget Set/Get Parent doesn't work in stand alone tests
- vtkAngleWidget
- Would like GetWidgetState macro, GetCurrentHandle macro.
- Access to HandleWidgets?
- vtkBidimensionalWidget
- Would like Get macros for WidgetState, CurrentHandle, HandleLine1Selected, HandleLine2Selected, Line1InnerSelected, Line1OuterSelected, Line2InnerSelected, Line2OuterSelected, CenterSelected.
- Access to HandleWidgets?
- vtkImplicitPlaneWidget2 Would like Get macro for WidgetState
- vtkLineWidget2
- Would like GetWidgetState macro, GetCurrentHandle macro
- Access to HandleWidgets?
- vtkSeedWidget
- Would like Get macros for WidgetState, Defining.
- Calling CreateNewHandle crashes if HandleRepresentation is null, need to test for that in *vtkSeedRepresentation::GetHandleRepresentation and in vtkSeedWidget::CreateNewHandle. Test currently failing, suggest that a default handle representation is created.
- vtkSplineWidget2 Would like Get macro for WidgetState
- vtkAngleWidget
- vtkBorderWidget Access to SetCursor?
- vtkCaptionWidget
- Access to HandleWidget?
- Only uses text actor 2d
- vtkTextWidget
- vtkCaptionWidget
- vtkHoverWidget Would like GetWidgetState macro
- vtkBalloonWidget
- Would like SetBalloonString
- Failing the basic interactor observer tests
- seems to be failing AddBalloon(prop1, cstr) after did a few other kinds of add balloon calls, the text string doesn't match when get it
- Problem with changing text on this widget, doesn't update the representation
- vtkBalloonWidget
- vtkAbstractWidget Set/Get Parent doesn't work in stand alone tests
General notes:
- when writing the macro for GetWidgetState, need to move the enum of the states to be public so can check for them.
Representations
Testing the representations:
- vtkProp
- vtkWidgetRepresentation - Get macros for Placed, ValidPick
- vtkAngleRepresentation
- BuildRepresenation doesn't check for null handle pointers
- SetXDisplayPosition doesn't have versions with three doubles
- GetXDisplayPosition doesn't have a version that returns a double*
- SetHandleRepresentation should be higher up in the .h file as mostly nothing works w/o it being called
- vtkAngleRepresentation2D
- BuildRepresentation doesn't check for null handle pointers.
- GetPoint1WorldPosition, GetCenterWorldPosition, GetPoint2WorldPosition, SetPoint1DisplayPosition, SetCenterDisplayPosition, SetPoint2DisplayPosition, GetPoint1DisplayPosition, GetCenterDisplayPosition, GetPoint2DisplayPosition don't check for null handle pointers
- HandleSize test fails with the lower clamp bound
- vtkAngleRepresentation3D
- TextActorScale is a convenience method that could use set macro that takes x,y,z
- vtkBalloonRepresentation - why no HoverRepresentation as a super class?
- vtkBiDimensionalRepresentation2D - is it missing 3D representation?
- vtkBorderRepresentation
- vtkCaptionRepresentation
- vtkTextRepresentation
- vtkImplicitPlaneRepresentation - does it match to vtkImplicitPlaneWidget2?
- vtkLineRepresentation - does it match to LineWidget2?
- vtkSeedRepresentation
- vtkSplineRepresentation
- vtkAngleRepresentation
- vtkWidgetRepresentation - Get macros for Placed, ValidPick