UNPKG

gpii-universal

Version:

Cross platform, core components of the GPII personalization infrastructure.

1,086 lines (1,074 loc) 68.8 kB
/*! GPII Transformer Tests Copyright 2012 OCAD University Copyright 2013-2014 Raising the Floor Copyright 2019 OCAD University Licensed under the New BSD license. You may not use this file except in compliance with this License. The research leading to these results has received funding from the European Union's Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016. You may obtain a copy of the License at https://github.com/GPII/universal/blob/master/LICENSE.txt */ "use strict"; var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"), jqUnit = fluid.require("node-jqunit", require, "jqUnit"); fluid.require("%flowManager/src/SystemUtils.js"); fluid.require("%settingsHandlers/src/settingsHandlerUtilities.js"); require("../src/js/Transformer.js"); fluid.registerNamespace("gpii.tests.transformer"); // TODO: Consolidate this kind of "canned" SR data so that we don't have to change schemas more than once. var testSolutionsEntry = { "com.microsoft.windows.magnifier": { "name": "Windows Built-in Screen Magnifier", "contexts": { "OS": [ { "id": "win32", "version": ">=5.0" } ] }, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier", "dataTypes": { "Magnification": "REG_DWORD", "Invert": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowCaret": "REG_DWORD", "FollowMouse": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" } }, "supportedSettings": { "Invert": {}, "Magnification": {}, "FollowMouse": {}, "FollowCaret": {}, "FollowFocus": {}, "MagnificationMode": {} }, "capabilitiesTransformations": { "Invert": "http://registry\\.gpii\\.net/common/invertColours", "Magnification": { "transform": { "type": "fluid.transforms.round", "input": { "transform": { "type": "fluid.transforms.linearScale", "inputPath": "http://registry\\.gpii\\.net/common/magnification", "factor": 100 } } } }, "transform": [ { "type": "fluid.transforms.arrayToSetMembership", "inputPath": "http://registry\\.gpii\\.net/common/tracking", "outputPath": "", "presentValue": 1, "missingValue": 0, "options": { "focus": "FollowFocus", "caret": "FollowCaret", "mouse": "FollowMouse" } } ], "MagnificationMode": { "transform": { "type": "fluid.transforms.valueMapper", "defaultInputPath": "http://registry\\.gpii\\.net/common/magnifierPosition", "match": { "FullScreen": 2, "Lens": 3, "LeftHalf": 1, "RightHalf": 1, "TopHalf": 1, "BottomHalf": 1, "Custom": 2 } } } } } }, "configure": [ "settings.conf" ], "restore": [ "settings.conf" ], "start": [ { "type": "gpii.launch.exec", "command": "${{environment}.SystemRoot}\\System32\\Magnify.exe" } ], "stop": [ { "type": "gpii.launch.exec", "command": "${{environment}.SystemRoot}\\System32\\taskkill.exe /f /im Magnify.exe" } ] }, "org.gnome.desktop.a11y.magnifier": { "name": "GNOME Shell Magnifier", "contexts": { "OS": [ { "id": "linux", "version": ">=2.6.26" } ] }, "capabilities": [ "http://registry\\.gpii\\.net/common/magnification/enabled" ], "settingsHandlers": { "configuration": { "type": "gpii.gsettings", "liveness": "live", "options": { "schema": "org.gnome.desktop.a11y.magnifier" }, "supportedSettings": { "mag-factor": {}, "show-cross-hairs": {}, "focus-tracking": {}, "caret-tracking": {}, "mouse-tracking": {}, "screen-position": {} }, "capabilitiesTransformations": { "mag-factor": "http://registry\\.gpii\\.net/common/magnification", "show-cross-hairs": "http://registry\\.gpii\\.net/common/showCrosshairs", "transform": { "type": "fluid.transforms.arrayToSetMembership", "inputPath": "http://registry\\.gpii\\.net/common/tracking", "outputPath": "", "presentValue": "proportional", "missingValue": "none", "options": { "focus": "focus-tracking", "caret": "caret-tracking", "mouse": "mouse-tracking" } }, "screen-position": { "transform": { "type": "fluid.transforms.valueMapper", "defaultInputPath": "http://registry\\.gpii\\.net/common/magnifierPosition", "match": { "FullScreen": "full-screen", "Lens": "full-screen", "LeftHalf": "left-half", "RightHalf": "right-half", "TopHalf": "top-half", "BottomHalf": "bottom-half" }, "noMatch": { "outputValue": "full-screen" } } } }, "inverseCapabilitiesTransformations": { "http://registry\\.gpii\\.net/common/magnification": "mag-factor", "http://registry\\.gpii\\.net/common/showCrosshairs": "show-cross-hairs", "transform": [ { "type": "fluid.transforms.valueMapper", "defaultInputPath": "screen-position", "defaultOutputPath": "http://registry\\.gpii\\.net/common/magnifierPosition", "match": { "full-screen": "FullScreen", "left-half": "LeftHalf", "right-half": "RightHalf", "top-half": "TopHalf", "bottom-half": "BottomHalf" } }, { "type": "fluid.transforms.valueMapper", "defaultOutputPath": "http://registry\\.gpii\\.net/common/tracking", "defaultInputPath": "mouse-tracking", "match": { "centered": "mouse" } } ] } } }, "launchHandlers": { "launcher": { "type": "gpii.gsettings.launch", "options": { "schema": "org.gnome.desktop.a11y.applications", "key": "screen-magnifier-enabled" } } }, "update": [ "settings.configuration" ], "isInstalled": [ { "type": "gpii.packageKit.find", "name": "gnome-shell" } ] }, // TODO: Consolidate this kind of "canned" SR data so that we don't have to change schemas more than once. "com.microsoft.windows.mouseSettings": { "name": "Windows typing autocorrection", "contexts": { "OS": [ { "id": "win32", "version": ">=5.0" } ] }, "settingsHandlers": { "configureMousePrimaryButton": { // TODO: Consolidate this kind of "canned" SR data so that we don't have to change schemas more than once. "type": "gpii.windows.spiSettingsHandler", "liveness": "live", "options": { "getAction": "SPI_GETMOUSEBUTTONSWAP", "setAction": "SPI_SETMOUSEBUTTONSWAP", "uiParam": 0, "pvParam": { "type": "BOOL" }, "fWinIni": "SPIF_UPDATEINIFILE|SPIF_SENDCHANGE" }, "supportedSettings": { "SwapMouseButtonsConfig": { "schema": { "title": "Swap mouse primary button", "description": "Swap mouse left/right buttons", "type": "boolean", "default": false } } }, "capabilitiesTransformations": { "SwapMouseButtonsConfig": { "transform": { "type": "fluid.transforms.value", "inputPath": "http://registry\\.gpii\\.net/applications/com\\.microsoft\\.windows\\.mouseSettings.SwapMouseButtons", "outputPath": "value" }, "path": { "literalValue": { "get": "pvParam", "set": "uiParam" } } } }, "inverseCapabilitiesTransformations": { "http://registry\\.gpii\\.net/applications/com\\.microsoft\\.windows\\.mouseSettings.SwapMouseButtons": "SwapMouseButtonsConfig.value" } }, "configureScrollWheelMode": { "type": "gpii.windows.spiSettingsHandler", "liveness": "live", "options": { "getAction": "SPI_GETWHEELSCROLLLINES", "setAction": "SPI_SETWHEELSCROLLLINES", "uiParam": 0, "pvParam": { "type": "UINT" }, "fWinIni": "SPIF_UPDATEINIFILE|SPIF_SENDCHANGE" }, "supportedSettings": { "ScrollWheelModeConfig": { "schema": { "title": "Mouse scroll wheel mode", "description": "Changes the number of lines to scroll when moving the scrollwheel.", "default": 3, "oneOf": [ { "title": "Range of accepted regular values", "type": "integer", "minimum": 1, "maximum": 100 }, { "title": "Values with special meaning", "enum": [4294967295], "enumLabels": ["full-page"] } ] } } }, "capabilitiesTransformations": { "ScrollWheelModeConfig": { "transform": { "type": "fluid.transforms.value", "inputPath": "http://registry\\.gpii\\.net/applications/com\\.microsoft\\.windows\\.mouseSettings.ScrollLines", "outputPath": "value" }, "path": { "literalValue": { "get": "pvParam", "set": "uiParam" } } } }, "inverseCapabilitiesTransformations": { "http://registry\\.gpii\\.net/applications/com\\.microsoft\\.windows\\.mouseSettings.ScrollLines": "ScrollWheelModeConfig.value" } } }, "configure": [ "settings.configureMousePrimaryButton", "settings.configureScrollWheelMode" ], "restore": [ "settings.configureMousePrimaryButton", "settings.configureScrollWheelMode" ], "isInstalled": [ { "type": "gpii.deviceReporter.alwaysInstalled" } ] }, // TODO: Consolidate this kind of "canned" SR data so that we don't have to change schemas more than once. "com.microsoft.windows.highContrast": { "name": "Windows High Contrast", "contexts": { "OS": [ { "id": "win32", "version": ">=5.0" } ] }, "settingsHandlers": { "configure-spi": { "type": "gpii.windows.spiSettingsHandler", "liveness": "live", "options": { "getAction": "SPI_GETHIGHCONTRAST", "setAction": "SPI_SETHIGHCONTRAST", "uiParam": "struct_size", "pvParam": { "type": "struct", "name": "HIGHCONTRAST" } }, "supportedSettings": { "HighContrastOn": { "schema": { "title": "High Contrast", "description": "Whether to enable/disable High Contrast", "type": "boolean", "default": false } } }, "capabilities": [ "http://registry\\.gpii\\.net/common/highContrast/enabled", "http://registry\\.gpii\\.net/common/highContrastTheme" ], "capabilitiesTransformations": { "HighContrastOn": { // (highContrast.enabled || highContrastTheme) && (highContrastTheme != "regular-contrast") "transform": { "type": "fluid.transforms.binaryOp", "left": { "transform": { "type": "fluid.transforms.binaryOp", "leftPath": "http://registry\\.gpii\\.net/common/highContrast/enabled", "left": false, "operator": "||", "rightPath": "http://registry\\.gpii\\.net/common/highContrastTheme", "right": false } }, "operator": "&&", "right": { "transform": { "type": "fluid.transforms.binaryOp", "left": "", "leftPath": "http://registry\\.gpii\\.net/common/highContrastTheme", "operator": "!==", "right": "regular-contrast" } }, "outputPath": "value" }, "path": { "transform": { "type": "fluid.transforms.literalValue", "input": "pvParam.dwFlags.HCF_HIGHCONTRASTON" } } } }, "inverseCapabilitiesTransformations": { "http://registry\\.gpii\\.net/common/highContrast/enabled": "HighContrastOn.value" } }, "configure-registry": { // This sets the high-contrast theme. "type": "gpii.windows.registrySettingsHandler", "liveness": "live", "options": { "hKey": "HKEY_CURRENT_USER", "path": "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes", "dataTypes": { "LastHighContrastTheme": "REG_SZ" } }, "supportedSettings": { "LastHighContrastTheme": { "schema": { "title": "High Contrast theme", "description": "High Contrast Theme", "type": "string", "default": "%SystemRoot%\\resources\\Ease of Access Themes\\hcwhite.theme", "enum": [ "%SystemRoot%\\resources\\Ease of Access Themes\\hcwhite.theme", "%SystemRoot%\\resources\\Ease of Access Themes\\hcblack.theme", "%SystemRoot%\\resources\\Ease of Access Themes\\hc1.theme", "%SystemRoot%\\resources\\Ease of Access Themes\\yellowOnBlack.theme", "%SystemRoot%\\resources\\Ease of Access Themes\\hc2.theme", "%SystemRoot%\\resources\\Ease of Access Themes\\blackOnBrown.theme", "%SystemRoot%\\resources\\Ease of Access Themes\\grayOnDark.theme", "%SystemRoot%\\resources\\Ease of Access Themes\\grayOnWhite.theme" ], "enumLabels": [ "Black on White", "White on Black", "Yellow on Black", "Black on Yellow", "Lime on Black", "Black on Brown", "Grey on Dark", "Grey on White" ] } } }, "capabilities": [ "http://registry\\.gpii\\.net/common/highContrast/enabled", "http://registry\\.gpii\\.net/common/highContrastTheme" ], "capabilitiesTransformations": { "LastHighContrastTheme": { "transform": { "type": "fluid.transforms.valueMapper", "defaultInputPath": "http://registry\\.gpii\\.net/common/highContrastTheme", "match": { "black-white": "${{environment}.SystemRoot}\\resources\\Ease of Access Themes\\hcwhite.theme", "white-black": "${{environment}.SystemRoot}\\resources\\Ease of Access Themes\\hcblack.theme", "yellow-black": "${{environment}.SystemRoot}\\resources\\Ease of Access Themes\\hc1.theme", "black-yellow": "${{environment}.SystemRoot}\\resources\\Ease of Access Themes\\yellowOnBlack.theme", "lime-black": "${{environment}.SystemRoot}\\resources\\Ease of Access Themes\\hc2.theme", "black-brown": "${{environment}.SystemRoot}\\resources\\Ease of Access Themes\\blackOnBrown.theme", "grey-black": "${{environment}.SystemRoot}\\resources\\Ease of Access Themes\\grayOnDark.theme", "grey-white": "${{environment}.SystemRoot}\\resources\\Ease of Access Themes\\grayOnWhite.theme" } } } } }, "configure-theme": { // This is used to specify the theme file that Windows will use when restoring high-contrast. The // file this setting points to is created by gpii, containing the currently unsaved theme settings. "type": "gpii.windows.registrySettingsHandler", "liveness": "live", "options": { "hKey": "HKEY_CURRENT_USER", "path": "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\HighContrast", "dataTypes": { "Pre-High Contrast Scheme": "REG_SZ" } }, "supportedSettings": { "Pre-High Contrast Scheme": {} }, "capabilities": [ "http://registry\\.gpii\\.net/common/highContrast/enabled", "http://registry\\.gpii\\.net/common/highContrastTheme" ], "capabilitiesTransformations": { "Pre-High Contrast Scheme": { "transform": { "type": "fluid.transforms.literalValue", "input": "${{environment}.LOCALAPPDATA}\\Microsoft\\Windows\\Themes\\Morphic.theme" } } } } }, "configure": [ // Set the "restore" theme. "settings.configure-theme", // Set the high-contrast theme. "settings.configure-registry", { // Save the current theme, and set the new high-contrast one. "type": "gpii.windows.spiSettingsHandler.setHighContrastTheme", "newTheme": "${{registry}HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\LastHighContrastTheme}", "currentTheme": "${{registry}HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\CurrentTheme}", "saveAs": "${{registry}HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\HighContrast\\Pre-High Contrast Scheme}" }, // Apply high-contrast. "settings.configure-spi" ], "restore": [ // Restore the high-contrast theme. "settings.configure-registry", // Disable high-contrast. "settings.configure-spi", // Restore the current theme. "settings.configure-theme" ], "isInstalled": [ { "type": "gpii.deviceReporter.registryKeyExists", "hKey": "HKEY_LOCAL_MACHINE", "path": "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe", "subPath": "", "dataType": "REG_SZ" } ] } }; gpii.tests.transformer.configurationToSettingsTestSpecs = [ { name: "Application specific settings for the same application", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.magnifier": { "FollowFocus": 0, "FollowCaret": 1, "FollowMouse": 1, "Invert": false } } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "settings": { "FollowCaret": 1, "FollowFocus": 0, "FollowMouse": 1, "Invert": false }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings } } } } }, { name: "Application specific settings filtered by supported settings", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.magnifier": { "FollowFocus": 0, "FollowCaret": 1, "FollowMouse": 1, "Invert": false, "wrongSetting": 200 } } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "settings": { "FollowCaret": 1, "FollowFocus": 0, "FollowMouse": 1, "Invert": false }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings } } } } }, { name: "Common terms only", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/common/tracking": [ "mouse", "caret" ] } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "settings": { "FollowCaret": 1, "FollowFocus": 0, "FollowMouse": 1 }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings } } } } }, { name: "Application scoped common terms are converted to application specific settings", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.magnifier": { "http://registry.gpii.net/common/invertColours": true } } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings, "settings": { "Invert": true } } } } } }, { name: "App scoped common terms overwrites top level common terms", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.magnifier": { "http://registry.gpii.net/common/invertColours": true }, "http://registry.gpii.net/common/invertColours": false } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings, "settings": { "Invert": true } } } } } }, { name: "App specific overwrites common terms", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.magnifier": { "FollowFocus": 0, "Invert": false }, "http://registry.gpii.net/common/invertColours": false } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "settings": { "Invert": false, "FollowFocus": 0 }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings } } } } }, { name: "App specific overwrites app scoped common terms", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.magnifier": { "FollowFocus": 0, "Invert": false, "http://registry.gpii.net/common/invertColours": true } } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "settings": { "Invert": false, "FollowFocus": 0 }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings } } } } }, { name: "Irelevant App specific settings are ignored", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/applications/some.app": { "settingA": 0 }, "http://registry.gpii.net/common/invertColours": false } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "settings": { "Invert": false }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings } } } } }, { name: "multi applications blocks", input: { "applications": { "com.microsoft.windows.magnifier": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.magnifier": { "Invert": false } } } } }, expected: { "com.microsoft.windows.magnifier": { "active": true, "name": testSolutionsEntry["com.microsoft.windows.magnifier"].name, "start": testSolutionsEntry["com.microsoft.windows.magnifier"].start, "stop": testSolutionsEntry["com.microsoft.windows.magnifier"].stop, "configure": testSolutionsEntry["com.microsoft.windows.magnifier"].configure, "restore": testSolutionsEntry["com.microsoft.windows.magnifier"].restore, "settingsHandlers": { "conf": { "type": "gpii.windows.registrySettingsHandler.set", "options": { "dataTypes": { "FollowCaret": "REG_DWORD", "FollowFocus": "REG_DWORD", "FollowMouse": "REG_DWORD", "Invert": "REG_DWORD", "Magnification": "REG_DWORD", "MagnificationMode": "REG_DWORD", "ZoomIncrement": "REG_DWORD" }, "hKey": "HKEY_CURRENT_USER", "path": "Software\\Microsoft\\ScreenMagnifier" }, "settings": { "Invert": false }, "capabilitiesTransformations": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.capabilitiesTransformations, "supportedSettings": testSolutionsEntry["com.microsoft.windows.magnifier"].settingsHandlers.conf.supportedSettings } } } } }, { name: "Application specific settings for non-existing solution", input: { "applications": { "com.microsoft.windows.bogus-app": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.bogus-app": { "FollowFocus": 0, "FollowCaret": 1, "FollowMouse": 1, "Invert": false } } } } }, expected: {} }, { name: "GPII-3435: Common terms ending with /enabled control launchHandler blocks", input: { "applications": { "org.gnome.desktop.a11y.magnifier": { "active": true, "settings": { "http://registry.gpii.net/common/magnification/enabled": true } } } }, expected: { "org.gnome.desktop.a11y.magnifier": { "name": "GNOME Shell Magnifier", "capabilities": [ "http://registry\\.gpii\\.net/common/magnification/enabled" ], "launchHandlers": { "launcher": { "type": "gpii.gsettings.launch", "options": { "schema": "org.gnome.desktop.a11y.applications", "key": "screen-magnifier-enabled" }, "settings": { "running": true } } }, "update": [], "isInstalled": [ { "type": "gpii.packageKit.find", "name": "gnome-shell" } ], "active": true } } }, { name: "GPII-3653: Filter out settings handlers that have no capability to handle the given setting", input: { "applications": { "com.microsoft.windows.mouseSettings": { "active": true, "settings": { "http://registry.gpii.net/applications/com.microsoft.windows.mouseSettings":{ "SwapMouseButtonsConfig": 1 } } } } }, expected: { "com.microsoft.windows.mouseSettings": {