This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eyes-common, eyes-sdk-core, visual-grid-client): supporting acce…
…ssibility regions to match request
- Loading branch information
1 parent
be9c713
commit cc9ec8c
Showing
25 changed files
with
549 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
packages/eyes-common/lib/config/AccessibilityMatchSettings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
'use strict'; | ||
|
||
const { GeneralUtils } = require('../utils/GeneralUtils'); | ||
const { Region } = require('../geometry/Region'); | ||
const { ArgumentGuard } = require('../utils/ArgumentGuard'); | ||
const { AccessibilityRegionType } = require('./AccessibilityRegionType'); | ||
|
||
/** | ||
* Encapsulates Accessibility match settings. | ||
*/ | ||
class AccessibilityMatchSettings { | ||
/** | ||
* @param {number} left | ||
* @param {number} top | ||
* @param {number} width | ||
* @param {number} height | ||
* @param {AccessibilityRegionType} type | ||
*/ | ||
constructor({ left, top, width, height, type } = {}) { | ||
if (arguments.length > 1) { | ||
throw new TypeError('Please, use object as a parameter to the constructor!'); | ||
} | ||
ArgumentGuard.isValidEnumValue(type, AccessibilityRegionType); | ||
|
||
this._left = left; | ||
this._top = top; | ||
this._width = width; | ||
this._height = height; | ||
this._type = type; | ||
} | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @return {number} | ||
*/ | ||
getLeft() { | ||
return this._left; | ||
} | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @param {number} value | ||
*/ | ||
setLeft(value) { | ||
this._left = value; | ||
} | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @return {number} | ||
*/ | ||
getTop() { | ||
return this._top; | ||
} | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @param {number} value | ||
*/ | ||
setTop(value) { | ||
this._top = value; | ||
} | ||
|
||
/** | ||
* @return {number} | ||
*/ | ||
getWidth() { | ||
return this._width; | ||
} | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @param {number} value | ||
*/ | ||
setWidth(value) { | ||
this._width = value; | ||
} | ||
|
||
/** | ||
* @return {number} | ||
*/ | ||
getHeight() { | ||
return this._height; | ||
} | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @param {number} value | ||
*/ | ||
setHeight(value) { | ||
this._height = value; | ||
} | ||
|
||
/** | ||
* @return {AccessibilityRegionType} | ||
*/ | ||
getType() { | ||
return this._type; | ||
} | ||
|
||
// noinspection JSUnusedGlobalSymbols | ||
/** | ||
* @param {AccessibilityRegionType} value | ||
*/ | ||
setType(value) { | ||
ArgumentGuard.isValidEnumValue(value, AccessibilityRegionType); | ||
this._type = value; | ||
} | ||
|
||
/** | ||
* @return {Region} | ||
*/ | ||
getRegion() { | ||
return new Region(this._left, this._top, this._width, this._height); | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
toJSON() { | ||
return GeneralUtils.toPlain(this); | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
toString() { | ||
return `AccessibilityMatchSettings { ${JSON.stringify(this)} }`; | ||
} | ||
} | ||
|
||
exports.AccessibilityMatchSettings = AccessibilityMatchSettings; |
23 changes: 23 additions & 0 deletions
23
packages/eyes-common/lib/config/AccessibilityRegionType.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
/** | ||
* The type of accessibility for a resion. | ||
* | ||
* @readonly | ||
* @enum {string} | ||
*/ | ||
const AccessibilityRegionType = { | ||
None: 'None', | ||
RegularText: 'RegularText', | ||
LargeText: 'LargeText', | ||
BoldText: 'BoldText', | ||
EssentialImage: 'EssentialImage', | ||
DisabledOrInactive: 'DisabledOrInactive', | ||
NonEssentialImage: 'NonEssentialImage', | ||
Logo: 'Logo', | ||
Background: 'Background', | ||
Ignore: 'Ignore', | ||
}; | ||
|
||
Object.freeze(AccessibilityRegionType); | ||
exports.AccessibilityRegionType = AccessibilityRegionType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.