Skip to content

Commit c3ccf0f

Browse files
committed
Core-AAM: Add remaining of role tests
1 parent 1d278cc commit c3ccf0f

39 files changed

Lines changed: 1416 additions & 0 deletions
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-alertdialog
2+
3+
TEST_HTML = "<div role='alertdialog' id='test'>content</div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_ALERT
10+
11+
node = atspi.find_node("test", session.url)
12+
assert atspi.Accessible.get_role(node) == atspi.Role.ALERT
13+
14+
# def test_axapi(axapi, session, inline):
15+
# session.url = inline(TEST_HTML)
16+
#
17+
# # Spec:
18+
# # AXRole: AXGroup
19+
# # AXSubrole: AXApplicationAlertDialog
20+
21+
# def test_ia2(ia2, session, inline):
22+
# session.url = inline(TEST_HTML)
23+
#
24+
# # Spec:
25+
# # Role: ROLE_SYSTEM_DIALOG
26+
# # Event: EVENT_SYSTEM_ALERT: .
27+
28+
# def test_uia(uia, session, inline):
29+
# session.url = inline(TEST_HTML)
30+
#
31+
# # Spec:
32+
# # Control Type: Pane

core-aam/aamtests/role/cell.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-cell
2+
3+
TEST_HTML = "<div role='table'> <div role='row'> <div role='cell' id='test'>content</div> </div> </div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_TABLE_CELL
10+
# Interface: TableCell
11+
12+
node = atspi.find_node("test", session.url)
13+
assert atspi.Accessible.get_role(node) == atspi.Role.TABLE_CELL
14+
assert atspi.Accessible.get_table_cell(node) is not None
15+
16+
# def test_axapi(axapi, session, inline):
17+
# session.url = inline(TEST_HTML)
18+
#
19+
# # Spec:
20+
# # AXRole: AXCell
21+
# # AXSubrole: <nil>
22+
23+
# def test_ia2(ia2, session, inline):
24+
# session.url = inline(TEST_HTML)
25+
#
26+
# # Spec:
27+
# # Role: ROLE_SYSTEM_CELL
28+
# # Interface: IAccessibleTableCell
29+
30+
# def test_uia(uia, session, inline):
31+
# session.url = inline(TEST_HTML)
32+
#
33+
# # Spec:
34+
# # Control Type: DataItem
35+
# # Localized Control Type: item
36+
# # Control Pattern: GridItem
37+
# # Control Pattern: TableItem
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-code
2+
3+
TEST_HTML = "<div role='code' id='test'>content</div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_STATIC
10+
# Object Attribute: xml-roles:code
11+
12+
node = atspi.find_node("test", session.url)
13+
assert atspi.Accessible.get_role(node) == atspi.Role.STATIC
14+
assert "xml-roles:code" in atspi.Accessible.get_attributes_as_array(node)
15+
16+
# def test_axapi(axapi, session, inline):
17+
# session.url = inline(TEST_HTML)
18+
#
19+
# # Spec:
20+
# # AXRole: AXGroup
21+
# # AXSubrole: AXCodeStyleGroup
22+
23+
# def test_ia2(ia2, session, inline):
24+
# session.url = inline(TEST_HTML)
25+
#
26+
# # Spec:
27+
# # Role: IA2_ROLE_TEXT_FRAME
28+
# # Object Attribute: xml-roles:code
29+
30+
# def test_uia(uia, session, inline):
31+
# session.url = inline(TEST_HTML)
32+
#
33+
# # Spec:
34+
# # Control Type: Text
35+
# # Localized Control Type: code
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-columnheader
2+
3+
TEST_HTML = "<div role='grid'> <div role='row'> <div role='columnheader' id='test'>content</div> </div> </div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_COLUMN_HEADER
10+
# Interface: TableCell
11+
12+
node = atspi.find_node("test", session.url)
13+
assert atspi.Accessible.get_role(node) == atspi.Role.COLUMN_HEADER
14+
assert atspi.Accessible.get_table_cell(node) is not None
15+
16+
# def test_axapi(axapi, session, inline):
17+
# session.url = inline(TEST_HTML)
18+
#
19+
# # Spec:
20+
# # AXRole: AXCell
21+
# # AXSubrole: <nil>
22+
23+
# def test_ia2(ia2, session, inline):
24+
# session.url = inline(TEST_HTML)
25+
#
26+
# # Spec:
27+
# # Role: ROLE_SYSTEM_COLUMNHEADER
28+
# # Interface: IAccessibleTableCell
29+
30+
# def test_uia(uia, session, inline):
31+
# session.url = inline(TEST_HTML)
32+
#
33+
# # Spec:
34+
# # Control Type: DataItem
35+
# # Localized Control Type: column header
36+
# # Control Pattern: GridItem
37+
# # Control Pattern: TableItem

core-aam/aamtests/role/comment.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-comment
2+
3+
TEST_HTML = "<div role='comment' id='test'>content</div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_COMMENT
10+
# Object Attribute: xml-roles:comment
11+
12+
node = atspi.find_node("test", session.url)
13+
assert atspi.Accessible.get_role(node) == atspi.Role.COMMENT
14+
assert "xml-roles:comment" in atspi.Accessible.get_attributes_as_array(node)
15+
16+
# def test_axapi(axapi, session, inline):
17+
# session.url = inline(TEST_HTML)
18+
#
19+
# # Spec:
20+
# # AXRole: AXGroup
21+
22+
# def test_ia2(ia2, session, inline):
23+
# session.url = inline(TEST_HTML)
24+
#
25+
# # Spec:
26+
# # Role: IA2_ROLE_COMMENT
27+
# # Object Attribute: xml-roles:comment
28+
29+
# def test_uia(uia, session, inline):
30+
# session.url = inline(TEST_HTML)
31+
#
32+
# # Spec:
33+
# # Control Type: Group
34+
# # Localized Control Type: comment

core-aam/aamtests/role/dialog.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-dialog
2+
3+
TEST_HTML = "<div role='dialog' id='test'>content</div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_DIALOG
10+
11+
node = atspi.find_node("test", session.url)
12+
assert atspi.Accessible.get_role(node) == atspi.Role.DIALOG
13+
14+
# def test_axapi(axapi, session, inline):
15+
# session.url = inline(TEST_HTML)
16+
#
17+
# # Spec:
18+
# # AXRole: AXGroup
19+
# # AXSubrole: AXApplicationDialog
20+
21+
# def test_ia2(ia2, session, inline):
22+
# session.url = inline(TEST_HTML)
23+
#
24+
# # Spec:
25+
# # Role: ROLE_SYSTEM_DIALOG
26+
27+
# def test_uia(uia, session, inline):
28+
# session.url = inline(TEST_HTML)
29+
#
30+
# # Spec:
31+
# # Control Type: Pane

core-aam/aamtests/role/form.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-form
2+
3+
TEST_HTML = "<div role='form' id='test' aria-labelled='the name of the form'>content</div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_LANDMARK
10+
# Object Attribute: xml-roles:form
11+
12+
node = atspi.find_node("test", session.url)
13+
assert atspi.Accessible.get_role(node) == atspi.Role.LANDMARK
14+
assert "xml-roles:form" in atspi.Accessible.get_attributes_as_array(node)
15+
16+
# def test_axapi(axapi, session, inline):
17+
# session.url = inline(TEST_HTML)
18+
#
19+
# # Spec:
20+
# # AXRole: AXGroup
21+
# # AXSubrole: AXLandmarkForm
22+
23+
# def test_ia2(ia2, session, inline):
24+
# session.url = inline(TEST_HTML)
25+
#
26+
# # Spec:
27+
# # Role: IA2_ROLE_FORM
28+
# # Object Attribute: xml-roles:form
29+
30+
# def test_uia(uia, session, inline):
31+
# session.url = inline(TEST_HTML)
32+
#
33+
# # Spec:
34+
# # Control Type: Group
35+
# # Localized Control Type: form
36+
# # Landmark Type: Form

core-aam/aamtests/role/grid.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-grid
2+
3+
TEST_HTML = "<div role='grid' id='test'> <div role='row' id='headerrow'> <div role='columnheader' id='colheader1'>content</div> <div role='columnheader' id='colheader2'>content</div> </div> <div role='row'> <div role='rowheader' id='rowheader1'>content</div> <div role='gridcell'>content</div> </div> <div role='row'> <div role='rowheader' id='rowheader2'>content</div> <div role='gridcell'>content</div> </div> </div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_TABLE
10+
# Object Attribute: xml-roles:grid
11+
# Interface: Table
12+
# Interface: Selection
13+
# Because WAI-ARIA does not support modifying the selection via the accessibility API, user agents MUST return false for all Selection methods that provide a means to modify the selection.
14+
15+
node = atspi.find_node("test", session.url)
16+
assert atspi.Accessible.get_role(node) == atspi.Role.TABLE
17+
assert "xml-roles:grid" in atspi.Accessible.get_attributes_as_array(node)
18+
assert atspi.Accessible.get_table_iface(node) is not None
19+
assert atspi.Accessible.get_selection_iface(node) is not None
20+
21+
# def test_axapi(axapi, session, inline):
22+
# session.url = inline(TEST_HTML)
23+
#
24+
# # Spec:
25+
# # AXRole: AXTable
26+
# # AXSubrole: <nil>
27+
# # AXColumnHeaderUIElements: a list of pointers to the columnheader elements
28+
# # AXHeader: a pointer to the row or group containing those columnheader elements
29+
# # AXRowHeaderUIElements: a list of pointers to the rowheader elements
30+
31+
# def test_ia2(ia2, session, inline):
32+
# session.url = inline(TEST_HTML)
33+
#
34+
# # Spec:
35+
# # Role: ROLE_SYSTEM_TABLE
36+
# # Object Attribute: xml-roles:grid
37+
# # Interface: IAccessibleTable2
38+
# # Method: IAccessible::accSelect()
39+
# # Method: IAccessible::get_accSelection()
40+
41+
# def test_uia(uia, session, inline):
42+
# session.url = inline(TEST_HTML)
43+
#
44+
# # Spec:
45+
# # Control Type: DataGrid
46+
# # Control Pattern: Grid
47+
# # Control Pattern: Table
48+
# # Control Pattern: Selection

core-aam/aamtests/role/gridcell.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-gridcell
2+
3+
TEST_HTML = "<div role='grid'> <div role='row'> <div role='gridcell' id='test'>content</div> </div> </div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_TABLE_CELL
10+
# Interface: TableCell
11+
12+
node = atspi.find_node("test", session.url)
13+
assert atspi.Accessible.get_role(node) == atspi.Role.TABLE_CELL
14+
assert atspi.Accessible.get_table_cell(node) is not None
15+
16+
# def test_axapi(axapi, session, inline):
17+
# session.url = inline(TEST_HTML)
18+
#
19+
# # Spec:
20+
# # AXRole: AXCell
21+
# # AXSubrole: <nil>
22+
23+
# def test_ia2(ia2, session, inline):
24+
# session.url = inline(TEST_HTML)
25+
#
26+
# # Spec:
27+
# # Role: ROLE_SYSTEM_CELL
28+
# # Interface: IAccessibleTableCell
29+
30+
# def test_uia(uia, session, inline):
31+
# session.url = inline(TEST_HTML)
32+
#
33+
# # Spec:
34+
# # Control Type: DataItem
35+
# # Localized Control Type: item
36+
# # Control Pattern: SelectionItem
37+
# # Control Pattern: GridItem
38+
# # Control Pattern: TableItem
39+
# # SelectionItem.SelectionContainer: grid

core-aam/aamtests/role/image.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Testing: https://w3c.github.io/core-aam/#role-map-image
2+
3+
TEST_HTML = "<div role='image' id='test'>content</div>"
4+
5+
def test_atspi(atspi, session, inline):
6+
session.url = inline(TEST_HTML)
7+
8+
# Spec:
9+
# Role: ROLE_IMAGE
10+
# Interface: Image
11+
12+
node = atspi.find_node("test", session.url)
13+
assert atspi.Accessible.get_role(node) == atspi.Role.IMAGE
14+
assert atspi.Accessible.get_image_iface(node) is not None
15+
16+
# def test_axapi(axapi, session, inline):
17+
# session.url = inline(TEST_HTML)
18+
#
19+
# # Spec:
20+
# # AXRole: AXImage
21+
# # AXSubrole: <nil>
22+
23+
# def test_ia2(ia2, session, inline):
24+
# session.url = inline(TEST_HTML)
25+
#
26+
# # Spec:
27+
# # Role: ROLE_SYSTEM_GRAPHIC
28+
# # Interface: IAccessibleImage
29+
30+
# def test_uia(uia, session, inline):
31+
# session.url = inline(TEST_HTML)
32+
#
33+
# # Spec:
34+
# # Control Type: Image

0 commit comments

Comments
 (0)