Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/issue 1824 Add missing DisplayCapabilities info and window ID #1825

Merged
merged 9 commits into from
Sep 12, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ private DisplayCapabilities createDisplayCapabilities(String displayName, Window
convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but can be empty
convertedCapabilities.setMediaClockFormats(TestValues.GENERAL_MEDIACLOCKFORMAT_LIST); // mandatory field but can be empty
convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported().contains(ImageType.DYNAMIC));
convertedCapabilities.setScreenParams(TestValues.GENERAL_SCREENPARAMS);

return convertedCapabilities;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ private DisplayCapabilities createDeprecatedDisplayCapabilities(String displayNa
// if there are imageTypes in the response, we must assume graphics are supported
convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported() != null && defaultMainWindow.getImageTypeSupported().size() > 0);

if (cachedSystemCapabilities.containsKey(SystemCapabilityType.DISPLAY)) {
// Copied from the RAI response, since this parameter is not present in WindowCapability
DisplayCapabilities displayCapabilitiesOld = (DisplayCapabilities) cachedSystemCapabilities.get(SystemCapabilityType.DISPLAY);
jacobkeeler marked this conversation as resolved.
Show resolved Hide resolved
convertedCapabilities.setScreenParams(displayCapabilitiesOld.getScreenParams());
if (displayCapabilitiesOld.getMediaClockFormats() != null) {
convertedCapabilities.setMediaClockFormats(displayCapabilitiesOld.getMediaClockFormats());
}
}

return convertedCapabilities;
}

Expand Down Expand Up @@ -246,7 +255,11 @@ public WindowCapability getWindowCapability(int windowID) {
for (WindowCapability windowCapability : display.getWindowCapabilities()) {
int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
if (currentWindowID == windowID) {
return windowCapability;
// Clone WindowCapability to prevent modification of stored WindowCapability in SystemCapabilityManager
WindowCapability windowCapabilityCopy = (WindowCapability) windowCapability.clone();
// A null windowID is assumed to be the DefaultWindow according to the spec, but that can be hard for developers to check, so set it explicitly.
windowCapabilityCopy.setWindowID(windowID);
return windowCapabilityCopy;
}
}
return null;
Expand Down