matt_tarka
11 years agoNew Contributor
JavaFX Tooltip
I am trying to get TesComplete 10.30 to confirm that a tooltip came up on screen in a JavaFX GUI.
The underlying JavaFX code checks a configuration file to determine the correct text to display for the tooltip. Thus, the text associated for the tooltip field that one can access through the object browser does not match what appears on screen. Alternately, what the GUI displays is not the same as what the tooltip field for the associated object has stored for the tooltip field.
Also, I cannot determine how to identify whether the tooltip actually appeared at a given time (outside of manually inspecting the Visualizer). I can get the Visualizer to capture the frame when the tooltip is onscreeen, but the Visualizer will not recognize the tooltip as an object.
I've been able to do this in script
set button1Obj = Sys.Process("java").JavaFXObject("Stage", "JDMS").JavaFXObject("Scene", "").JavaFXObject("ScrollPane", "").JavaFXObject("provisionTitledPane").JavaFXObject("button1")
‘I then got the ‘tooltip’ field for the button1Obj by looking at the fields of button1Obj
set result = aqObject.GetFields(button1Obj, True)
for i = 0 to result.Count - 1
set objField = result(i)
if objField.Name = "tooltip" then
set tooltipField = objField
set tooltipVObj = tooltipField.Value
set tooltipVObj = tooltipField.Value
‘tooltipVObj has JavaFullClassName: javafx.scene.control.Control$3
set tooltipVVObj = aqObject.GetPropertyValue(tooltipVObj, "Value")
‘tooltipVVObj has JavaFullClassname: javafx.scene.control.Tooltip
set tooltipVVTObj = aqObject.GetPropertyValue(tooltipVVObj, "Text")
‘tooltipVVObj has tooltipVVTObj JavaFullClassName: javafx.beans.property.SimpleStringProperty
set tooltipText = aqObject.GetPropertyValue(tooltipVVTObj, "Value")
‘tooltipText has JavaFullClassName: java.lang.String
log.checkpoint "Tooltip OleValue: " + tooltipTextOleValue
‘the OleValue is the default value that the code overwrites when it generates the tooltip
log.checkpoint "Tooltip JavaFullClassName: " + tooltipTextFullClassName
exit for
end if
Next
Tooltip OleValue is a default value for the tooltip that the code replaces after looking up the button name in a configuration file.
When I try to run the FindChild on any of the objects (except the button1Obj which is a JavaFX object) that I set, I get an error (see attached), if not visisble below. I did not find any children of the button1Obj with the FindChild("JavaFullClassName","*").
Here is an example of the command:
set javaClass = tooltipField.FindChild("JavaFullClassName","*")
I am at a loss for here. I've looked at other threads, but they were not JavaFX-specific and didn't lead me to where I want to be. I wince at the thought of needing to access the JavaRuntime.JavaClasses because I toyed with that approach already and was not able to access the value that I wanted (because the values weren't easily identifiable in the class).
The underlying JavaFX code checks a configuration file to determine the correct text to display for the tooltip. Thus, the text associated for the tooltip field that one can access through the object browser does not match what appears on screen. Alternately, what the GUI displays is not the same as what the tooltip field for the associated object has stored for the tooltip field.
Also, I cannot determine how to identify whether the tooltip actually appeared at a given time (outside of manually inspecting the Visualizer). I can get the Visualizer to capture the frame when the tooltip is onscreeen, but the Visualizer will not recognize the tooltip as an object.
I've been able to do this in script
set button1Obj = Sys.Process("java").JavaFXObject("Stage", "JDMS").JavaFXObject("Scene", "").JavaFXObject("ScrollPane", "").JavaFXObject("provisionTitledPane").JavaFXObject("button1")
‘I then got the ‘tooltip’ field for the button1Obj by looking at the fields of button1Obj
set result = aqObject.GetFields(button1Obj, True)
for i = 0 to result.Count - 1
set objField = result(i)
if objField.Name = "tooltip" then
set tooltipField = objField
set tooltipVObj = tooltipField.Value
set tooltipVObj = tooltipField.Value
‘tooltipVObj has JavaFullClassName: javafx.scene.control.Control$3
set tooltipVVObj = aqObject.GetPropertyValue(tooltipVObj, "Value")
‘tooltipVVObj has JavaFullClassname: javafx.scene.control.Tooltip
set tooltipVVTObj = aqObject.GetPropertyValue(tooltipVVObj, "Text")
‘tooltipVVObj has tooltipVVTObj JavaFullClassName: javafx.beans.property.SimpleStringProperty
set tooltipText = aqObject.GetPropertyValue(tooltipVVTObj, "Value")
‘tooltipText has JavaFullClassName: java.lang.String
log.checkpoint "Tooltip OleValue: " + tooltipTextOleValue
‘the OleValue is the default value that the code overwrites when it generates the tooltip
log.checkpoint "Tooltip JavaFullClassName: " + tooltipTextFullClassName
exit for
end if
Next
Tooltip OleValue is a default value for the tooltip that the code replaces after looking up the button name in a configuration file.
When I try to run the FindChild on any of the objects (except the button1Obj which is a JavaFX object) that I set, I get an error (see attached), if not visisble below. I did not find any children of the button1Obj with the FindChild("JavaFullClassName","*").
Here is an example of the command:
set javaClass = tooltipField.FindChild("JavaFullClassName","*")
I am at a loss for here. I've looked at other threads, but they were not JavaFX-specific and didn't lead me to where I want to be. I wince at the thought of needing to access the JavaRuntime.JavaClasses because I toyed with that approach already and was not able to access the value that I wanted (because the values weren't easily identifiable in the class).