forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure web_ui and ui have the same toString methods for StringAttribu…
…tes (flutter#29323)
- Loading branch information
Showing
5 changed files
with
108 additions
and
43 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
@TestOn('chrome || safari || firefox') | ||
|
||
import 'package:test/bootstrap/browser.dart'; | ||
import 'package:test/test.dart'; | ||
import 'package:ui/ui.dart'; | ||
|
||
void main() { | ||
internalBootstrapBrowserTest(() => testMain); | ||
} | ||
|
||
// The body of this file is the same as ../../../../../testing/dart/semantics_test.dart | ||
// Please keep them in sync. | ||
|
||
void testMain() { | ||
// This must match the number of flags in lib/ui/semantics.dart | ||
const int numSemanticsFlags = 25; | ||
test('SemanticsFlag.values refers to all flags.', () async { | ||
expect(SemanticsFlag.values.length, equals(numSemanticsFlags)); | ||
for (int index = 0; index < numSemanticsFlags; ++index) { | ||
final int flag = 1 << index; | ||
expect(SemanticsFlag.values[flag], isNotNull); | ||
expect(SemanticsFlag.values[flag].toString(), startsWith('SemanticsFlag.')); | ||
} | ||
}); | ||
|
||
// This must match the number of actions in lib/ui/semantics.dart | ||
const int numSemanticsActions = 22; | ||
test('SemanticsAction.values refers to all actions.', () async { | ||
expect(SemanticsAction.values.length, equals(numSemanticsActions)); | ||
for (int index = 0; index < numSemanticsActions; ++index) { | ||
final int flag = 1 << index; | ||
expect(SemanticsAction.values[flag], isNotNull); | ||
expect(SemanticsAction.values[flag].toString(), startsWith('SemanticsAction.')); | ||
} | ||
}); | ||
|
||
test('SpellOutStringAttribute.toString', () async { | ||
expect(SpellOutStringAttribute(range: const TextRange(start: 2, end: 5)).toString(), 'SpellOutStringAttribute(TextRange(start: 2, end: 5))'); | ||
}); | ||
|
||
test('LocaleStringAttribute.toString', () async { | ||
expect(LocaleStringAttribute(range: const TextRange(start: 2, end: 5), locale: const Locale('test')).toString(), 'LocaleStringAttribute(TextRange(start: 2, end: 5), test)'); | ||
}); | ||
} |
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