Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0ff84fc

Browse files
committed
browser-specific fixes
1 parent 52076d3 commit 0ff84fc

File tree

2 files changed

+39
-71
lines changed

2 files changed

+39
-71
lines changed

lib/web_ui/test/canvaskit/semantics_test.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ void main() {
2020
// yet share platform view logic with the HTML renderer, which affects
2121
// semantics.
2222
Future<void> testMain() async {
23-
setUpCanvasKitTest();
24-
runSemanticsTests();
23+
group('CanvasKit semantics', () {
24+
setUpCanvasKitTest();
25+
26+
runSemanticsTests();
27+
// TODO(hterkelsen): https://github.com/flutter/flutter/issues/60040
28+
}, skip: isIosSafari);
2529
}

lib/web_ui/test/engine/semantics/semantics_test.dart

Lines changed: 33 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import 'package:test/test.dart';
1515
import 'package:ui/src/engine.dart';
1616
import 'package:ui/ui.dart' as ui;
1717

18+
import '../../common.dart';
1819
import 'semantics_tester.dart';
1920

2021
DateTime _testTime = DateTime(2018, 12, 17);
@@ -537,21 +538,12 @@ void _testContainer() {
537538
);
538539

539540
semantics().updateSemantics(builder.build());
540-
if (browserEngine == BrowserEngine.edge) {
541-
expectSemanticsTree('''
542-
<sem style="color: rgba(0, 0, 0, 0); filter: opacity(0%)">
543-
<sem-c>
544-
<sem></sem>
545-
</sem-c>
546-
</sem>''');
547-
} else {
548-
expectSemanticsTree('''
541+
expectSemanticsTree('''
549542
<sem style="$rootSemanticStyle">
550543
<sem-c>
551544
<sem></sem>
552545
</sem-c>
553546
</sem>''');
554-
}
555547

556548
final html.Element parentElement =
557549
appHostNode.querySelector('flt-semantics')!;
@@ -1094,9 +1086,7 @@ void _testIncrementables() {
10941086
expect(await logger.actionLog.first, ui.SemanticsAction.decrease);
10951087

10961088
semantics().semanticsEnabled = false;
1097-
},
1098-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1099-
skip: browserEngine == BrowserEngine.edge);
1089+
});
11001090

11011091
test('renders a node that can both increment and decrement', () async {
11021092
semantics()
@@ -1125,9 +1115,7 @@ void _testIncrementables() {
11251115
</sem>''');
11261116

11271117
semantics().semanticsEnabled = false;
1128-
},
1129-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1130-
skip: browserEngine == BrowserEngine.edge);
1118+
});
11311119
}
11321120

11331121
void _testTextField() {
@@ -1154,9 +1142,7 @@ void _testTextField() {
11541142
</sem>''');
11551143

11561144
semantics().semanticsEnabled = false;
1157-
},
1158-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1159-
skip: browserEngine == BrowserEngine.edge);
1145+
});
11601146

11611147
// TODO(yjbanov): this test will need to be adjusted for Safari when we add
11621148
// Safari testing.
@@ -1223,9 +1209,7 @@ void _testCheckables() {
12231209
''');
12241210

12251211
semantics().semanticsEnabled = false;
1226-
},
1227-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1228-
skip: browserEngine == BrowserEngine.edge);
1212+
});
12291213

12301214
test('renders a switched on disabled switch element', () async {
12311215
semantics()
@@ -1251,9 +1235,7 @@ void _testCheckables() {
12511235
''');
12521236

12531237
semantics().semanticsEnabled = false;
1254-
},
1255-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1256-
skip: browserEngine == BrowserEngine.edge);
1238+
});
12571239

12581240
test('renders a switched off switch element', () async {
12591241
semantics()
@@ -1279,9 +1261,7 @@ void _testCheckables() {
12791261
''');
12801262

12811263
semantics().semanticsEnabled = false;
1282-
},
1283-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1284-
skip: browserEngine == BrowserEngine.edge);
1264+
});
12851265

12861266
test('renders a checked checkbox', () async {
12871267
semantics()
@@ -1308,9 +1288,7 @@ void _testCheckables() {
13081288
''');
13091289

13101290
semantics().semanticsEnabled = false;
1311-
},
1312-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1313-
skip: browserEngine == BrowserEngine.edge);
1291+
});
13141292

13151293
test('renders a checked disabled checkbox', () async {
13161294
semantics()
@@ -1336,9 +1314,7 @@ void _testCheckables() {
13361314
''');
13371315

13381316
semantics().semanticsEnabled = false;
1339-
},
1340-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1341-
skip: browserEngine == BrowserEngine.edge);
1317+
});
13421318

13431319
test('renders an unchecked checkbox', () async {
13441320
semantics()
@@ -1364,9 +1340,7 @@ void _testCheckables() {
13641340
''');
13651341

13661342
semantics().semanticsEnabled = false;
1367-
},
1368-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1369-
skip: browserEngine == BrowserEngine.edge);
1343+
});
13701344

13711345
test('renders a checked radio button', () async {
13721346
semantics()
@@ -1394,9 +1368,7 @@ void _testCheckables() {
13941368
''');
13951369

13961370
semantics().semanticsEnabled = false;
1397-
},
1398-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1399-
skip: browserEngine == BrowserEngine.edge);
1371+
});
14001372

14011373
test('renders a checked disabled radio button', () async {
14021374
semantics()
@@ -1423,9 +1395,7 @@ void _testCheckables() {
14231395
''');
14241396

14251397
semantics().semanticsEnabled = false;
1426-
},
1427-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1428-
skip: browserEngine == BrowserEngine.edge);
1398+
});
14291399

14301400
test('renders an unchecked checkbox', () async {
14311401
semantics()
@@ -1452,9 +1422,7 @@ void _testCheckables() {
14521422
''');
14531423

14541424
semantics().semanticsEnabled = false;
1455-
},
1456-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1457-
skip: browserEngine == BrowserEngine.edge);
1425+
});
14581426
}
14591427

14601428
void _testTappable() {
@@ -1481,9 +1449,7 @@ void _testTappable() {
14811449
expect(tester.getSemanticsObject(0).element.tabIndex, 0);
14821450

14831451
semantics().semanticsEnabled = false;
1484-
},
1485-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1486-
skip: browserEngine == BrowserEngine.edge);
1452+
});
14871453

14881454
test('renders a disabled tappable widget', () async {
14891455
semantics()
@@ -1508,9 +1474,7 @@ void _testTappable() {
15081474
''');
15091475

15101476
semantics().semanticsEnabled = false;
1511-
},
1512-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1513-
skip: browserEngine == BrowserEngine.edge);
1477+
});
15141478
}
15151479

15161480
void _testImage() {
@@ -1536,9 +1500,7 @@ void _testImage() {
15361500
''');
15371501

15381502
semantics().semanticsEnabled = false;
1539-
},
1540-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1541-
skip: browserEngine == BrowserEngine.edge);
1503+
});
15421504

15431505
test('renders an image with a child node and with a label', () async {
15441506
semantics()
@@ -1575,9 +1537,7 @@ void _testImage() {
15751537
</sem>''');
15761538

15771539
semantics().semanticsEnabled = false;
1578-
},
1579-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1580-
skip: browserEngine == BrowserEngine.edge);
1540+
});
15811541

15821542
test('renders an image with no child nodes without a label', () async {
15831543
semantics()
@@ -1599,9 +1559,7 @@ void _testImage() {
15991559
'''<sem role="img" style="$rootSemanticStyle"></sem>''');
16001560

16011561
semantics().semanticsEnabled = false;
1602-
},
1603-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1604-
skip: browserEngine == BrowserEngine.edge);
1562+
});
16051563

16061564
test('renders an image with a child node and without a label', () async {
16071565
semantics()
@@ -1637,9 +1595,7 @@ void _testImage() {
16371595
</sem>''');
16381596

16391597
semantics().semanticsEnabled = false;
1640-
},
1641-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1642-
skip: browserEngine == BrowserEngine.edge);
1598+
});
16431599
}
16441600

16451601
void _testLiveRegion() {
@@ -1665,9 +1621,7 @@ void _testLiveRegion() {
16651621
''');
16661622

16671623
semantics().semanticsEnabled = false;
1668-
},
1669-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/50754
1670-
skip: browserEngine == BrowserEngine.edge);
1624+
});
16711625

16721626
test('does not render a live region if there is no label', () async {
16731627
semantics()
@@ -1848,7 +1802,13 @@ void _testPlatformView() {
18481802
// root, it would be reachable both from the shadow root (by hitting the
18491803
// corresponding <slot> tag) and from the document (by hitting the platform
18501804
// view element itself).
1851-
expect(shadowRoot.elementFromPoint(10, 30)!, platformViewElement);
1805+
1806+
// Browsers disagree about which element should be returned when hit testing
1807+
// a shadow root. However, they do agree when hit testing `document`.
1808+
//
1809+
// See:
1810+
// * https://github.com/w3c/csswg-drafts/issues/556
1811+
// * https://bugzilla.mozilla.org/show_bug.cgi?id=1502369
18521812
expect(html.document.elementFromPoint(10, 30)!, platformViewElement);
18531813

18541814
// Hit test overlap between child 2 and 3
@@ -1858,7 +1818,11 @@ void _testPlatformView() {
18581818
expect(shadowRoot.elementFromPoint(10, 50)!, child3);
18591819

18601820
semantics().semanticsEnabled = false;
1861-
});
1821+
// TODO(yjbanov): unable to debug this test on iOS Safari as hacking on a
1822+
// Linux machine. iOS Safari returns getBoundingClientRect
1823+
// values that are half of desktop browsers, possibly due to
1824+
// devicePixelRatio but need to confirm.
1825+
}, skip: isIosSafari);
18621826
}
18631827

18641828
/// A facade in front of [ui.SemanticsUpdateBuilder.updateNode] that

0 commit comments

Comments
 (0)