mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Sync lints with flutter/flutter (flutter/engine#49192)
This commit is contained in:
parent
50beeb112d
commit
dbfad3bfed
@ -1,7 +1,7 @@
|
||||
# Specify analysis options.
|
||||
#
|
||||
# This file is a copy of analysis_options.yaml from flutter repo
|
||||
# as of 2023-03-22, but with some modifications marked with
|
||||
# as of 2023-12-18, but with some modifications marked with
|
||||
# "DIFFERENT FROM FLUTTER/FLUTTER" below.
|
||||
|
||||
analyzer:
|
||||
@ -20,7 +20,7 @@ analyzer:
|
||||
linter:
|
||||
rules:
|
||||
# This list is derived from the list of all available lints located at
|
||||
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
|
||||
# https://github.com/dart-lang/linter/blob/main/example/all.yaml
|
||||
- always_declare_return_types
|
||||
- always_put_control_body_on_new_line
|
||||
# - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
|
||||
@ -31,7 +31,7 @@ linter:
|
||||
- avoid_bool_literals_in_conditional_expressions
|
||||
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
|
||||
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
|
||||
# - avoid_classes_with_only_static_members # we do this commonly
|
||||
# - avoid_classes_with_only_static_members # we do this commonly for `abstract final class`es
|
||||
- avoid_double_and_int_checks
|
||||
- avoid_dynamic_calls
|
||||
- avoid_empty_else
|
||||
@ -40,7 +40,7 @@ linter:
|
||||
- avoid_field_initializers_in_const_classes
|
||||
# - avoid_final_parameters # incompatible with prefer_final_parameters
|
||||
- avoid_function_literals_in_foreach_calls
|
||||
- avoid_implementing_value_types
|
||||
# - avoid_implementing_value_types # see https://github.com/dart-lang/linter/issues/4558
|
||||
- avoid_init_to_null
|
||||
- avoid_js_rounded_ints
|
||||
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
|
||||
@ -82,6 +82,7 @@ linter:
|
||||
- dangling_library_doc_comments
|
||||
- depend_on_referenced_packages
|
||||
- deprecated_consistency
|
||||
# - deprecated_member_use_from_same_package # we allow self-references to deprecated members
|
||||
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
|
||||
- directives_ordering
|
||||
# - discarded_futures # too many false positives, similar to unawaited_futures
|
||||
@ -96,8 +97,8 @@ linter:
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- implicit_call_tearoffs
|
||||
- implicit_reopen
|
||||
- invalid_case_patterns
|
||||
- iterable_contains_unrelated_type
|
||||
# - join_return_with_assignment # not required by flutter style
|
||||
- leading_newlines_in_multiline_strings
|
||||
- library_annotations
|
||||
@ -105,16 +106,19 @@ linter:
|
||||
- library_prefixes
|
||||
- library_private_types_in_public_api
|
||||
# - lines_longer_than_80_chars # not required by flutter style
|
||||
- list_remove_unrelated_type
|
||||
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
|
||||
- literal_only_boolean_expressions
|
||||
# - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509
|
||||
# - missing_whitespace_between_adjacent_strings # DIFFERENT FROM FLUTTER/FLUTTER (too many false positives)
|
||||
- no_adjacent_strings_in_list
|
||||
- no_default_cases
|
||||
- no_duplicate_case_values
|
||||
- no_leading_underscores_for_library_prefixes
|
||||
- no_leading_underscores_for_local_identifiers
|
||||
- no_literal_bool_comparisons
|
||||
- no_logic_in_create_state
|
||||
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
|
||||
- no_self_assignments
|
||||
- no_wildcard_variable_uses
|
||||
- non_constant_identifier_names
|
||||
- noop_primitive_operations
|
||||
- null_check_on_nullable_type_parameter
|
||||
@ -143,7 +147,7 @@ linter:
|
||||
- prefer_final_fields
|
||||
- prefer_final_in_for_each
|
||||
- prefer_final_locals
|
||||
# - prefer_final_parameters # we should enable this one day when it can be auto-fixed (https://github.com/dart-lang/linter/issues/3104), see also parameter_assignments
|
||||
# - prefer_final_parameters # adds too much verbosity
|
||||
- prefer_for_elements_to_map_fromIterable
|
||||
- prefer_foreach
|
||||
- prefer_function_declarations_over_variables
|
||||
@ -183,6 +187,7 @@ linter:
|
||||
- tighten_type_of_initializing_formals
|
||||
# - type_annotate_public_apis # subset of always_specify_types
|
||||
- type_init_formals
|
||||
- type_literal_in_constant_pattern
|
||||
# - unawaited_futures # too many false positives, especially with the way AnimationController works
|
||||
- unnecessary_await_in_return
|
||||
- unnecessary_brace_in_string_interps
|
||||
@ -208,7 +213,7 @@ linter:
|
||||
- unnecessary_string_interpolations
|
||||
- unnecessary_this
|
||||
- unnecessary_to_list_in_spreads
|
||||
# - unreachable_from_main # Do not enable this rule until it is un-marked as "experimental" and carefully re-evaluated.
|
||||
- unreachable_from_main
|
||||
- unrelated_type_equality_checks
|
||||
- unsafe_html
|
||||
- use_build_context_synchronously
|
||||
|
||||
@ -20,8 +20,6 @@ class FormattingException implements Exception {
|
||||
final String message;
|
||||
final ProcessResult? result;
|
||||
|
||||
int get exitCode => result?.exitCode ?? -1;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
final StringBuffer output = StringBuffer(runtimeType.toString());
|
||||
@ -109,7 +107,6 @@ abstract class FormatChecker {
|
||||
ProcessManager processManager = const LocalProcessManager(),
|
||||
required this.baseGitRef,
|
||||
required this.repoDir,
|
||||
required this.srcDir,
|
||||
this.allFiles = false,
|
||||
this.messageCallback,
|
||||
}) : _processRunner = ProcessRunner(
|
||||
@ -142,7 +139,6 @@ abstract class FormatChecker {
|
||||
processManager: processManager,
|
||||
baseGitRef: baseGitRef,
|
||||
repoDir: repoDir,
|
||||
srcDir: srcDir,
|
||||
allFiles: allFiles,
|
||||
messageCallback: messageCallback,
|
||||
);
|
||||
@ -160,7 +156,6 @@ abstract class FormatChecker {
|
||||
processManager: processManager,
|
||||
baseGitRef: baseGitRef,
|
||||
repoDir: repoDir,
|
||||
srcDir: srcDir,
|
||||
allFiles: allFiles,
|
||||
messageCallback: messageCallback,
|
||||
);
|
||||
@ -169,7 +164,6 @@ abstract class FormatChecker {
|
||||
processManager: processManager,
|
||||
baseGitRef: baseGitRef,
|
||||
repoDir: repoDir,
|
||||
srcDir: srcDir,
|
||||
allFiles: allFiles,
|
||||
messageCallback: messageCallback,
|
||||
);
|
||||
@ -177,7 +171,6 @@ abstract class FormatChecker {
|
||||
}
|
||||
|
||||
final ProcessRunner _processRunner;
|
||||
final Directory srcDir;
|
||||
final Directory repoDir;
|
||||
final bool allFiles;
|
||||
MessageCallback? messageCallback;
|
||||
@ -302,9 +295,7 @@ class ClangFormatChecker extends FormatChecker {
|
||||
required Directory srcDir,
|
||||
super.allFiles,
|
||||
super.messageCallback,
|
||||
}) : super(
|
||||
srcDir: srcDir,
|
||||
) {
|
||||
}) {
|
||||
/*late*/ String clangOs;
|
||||
if (Platform.isLinux) {
|
||||
clangOs = 'linux-x64';
|
||||
@ -462,9 +453,7 @@ class JavaFormatChecker extends FormatChecker {
|
||||
required Directory srcDir,
|
||||
super.allFiles,
|
||||
super.messageCallback,
|
||||
}) : super(
|
||||
srcDir: srcDir,
|
||||
) {
|
||||
}) {
|
||||
googleJavaFormatJar = File(
|
||||
path.absolute(
|
||||
path.join(
|
||||
@ -619,7 +608,6 @@ class GnFormatChecker extends FormatChecker {
|
||||
super.processManager,
|
||||
required super.baseGitRef,
|
||||
required Directory repoDir,
|
||||
required super.srcDir,
|
||||
super.allFiles,
|
||||
super.messageCallback,
|
||||
}) : super(
|
||||
@ -750,7 +738,6 @@ class PythonFormatChecker extends FormatChecker {
|
||||
super.processManager,
|
||||
required super.baseGitRef,
|
||||
required Directory repoDir,
|
||||
required super.srcDir,
|
||||
super.allFiles,
|
||||
super.messageCallback,
|
||||
}) : super(
|
||||
@ -845,7 +832,6 @@ class WhitespaceFormatChecker extends FormatChecker {
|
||||
super.processManager,
|
||||
required super.baseGitRef,
|
||||
required super.repoDir,
|
||||
required super.srcDir,
|
||||
super.allFiles,
|
||||
super.messageCallback,
|
||||
});
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
Signature: 5e484e46971049766e74d801d325ad63
|
||||
Signature: b0fbe71c20bdf5b2a1c163281b1f90de
|
||||
|
||||
|
||||
@ -6,43 +6,34 @@ import 'dart:io' as io;
|
||||
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
|
||||
import '../bin/format.dart' as target;
|
||||
|
||||
final io.File script = io.File.fromUri(io.Platform.script).absolute;
|
||||
final io.Directory repoDir = script.parent.parent.parent;
|
||||
final ProcessPool pool = ProcessPool(
|
||||
numWorkers: 1,
|
||||
processRunner: ProcessRunner(defaultWorkingDirectory: repoDir),
|
||||
);
|
||||
|
||||
class FileContentPair {
|
||||
FileContentPair(this.original, this.formatted, this.fileExtension);
|
||||
FileContentPair(this.original, this.formatted);
|
||||
|
||||
final String original;
|
||||
final String formatted;
|
||||
final String fileExtension;
|
||||
}
|
||||
|
||||
final FileContentPair ccContentPair = FileContentPair(
|
||||
'int main(){return 0;}\n', 'int main() {\n return 0;\n}\n', '.cc');
|
||||
'int main(){return 0;}\n', 'int main() {\n return 0;\n}\n');
|
||||
final FileContentPair hContentPair =
|
||||
FileContentPair('int\nmain\n()\n;\n', 'int main();\n', '.h');
|
||||
FileContentPair('int\nmain\n()\n;\n', 'int main();\n');
|
||||
final FileContentPair gnContentPair = FileContentPair(
|
||||
'test\n(){testvar=true}\n', 'test() {\n testvar = true\n}\n', '.gn');
|
||||
'test\n(){testvar=true}\n', 'test() {\n testvar = true\n}\n');
|
||||
final FileContentPair javaContentPair = FileContentPair(
|
||||
'class Test{public static void main(String args[]){System.out.println("Test");}}\n',
|
||||
'class Test {\n public static void main(String args[]) {\n System.out.println("Test");\n }\n}\n',
|
||||
'.java');
|
||||
'class Test {\n public static void main(String args[]) {\n System.out.println("Test");\n }\n}\n');
|
||||
final FileContentPair pythonContentPair = FileContentPair(
|
||||
"if __name__=='__main__':\n sys.exit(\nMain(sys.argv)\n)\n",
|
||||
"if __name__ == '__main__':\n sys.exit(Main(sys.argv))\n",
|
||||
'.py');
|
||||
"if __name__ == '__main__':\n sys.exit(Main(sys.argv))\n");
|
||||
final FileContentPair whitespaceContentPair = FileContentPair(
|
||||
'int main() {\n return 0; \n}\n',
|
||||
'int main() {\n return 0;\n}\n',
|
||||
'.c');
|
||||
'int main() {\n return 0;\n}\n');
|
||||
|
||||
class TestFileFixture {
|
||||
TestFileFixture(this.type) {
|
||||
@ -106,31 +97,26 @@ class TestFileFixture {
|
||||
path.extension(file.path) == '.cc'
|
||||
? ccContentPair.formatted
|
||||
: hContentPair.formatted,
|
||||
path.extension(file.path),
|
||||
);
|
||||
case target.FormatCheck.gn:
|
||||
return FileContentPair(
|
||||
content,
|
||||
gnContentPair.formatted,
|
||||
path.extension(file.path),
|
||||
);
|
||||
case target.FormatCheck.java:
|
||||
return FileContentPair(
|
||||
content,
|
||||
javaContentPair.formatted,
|
||||
path.extension(file.path),
|
||||
);
|
||||
case target.FormatCheck.python:
|
||||
return FileContentPair(
|
||||
content,
|
||||
pythonContentPair.formatted,
|
||||
path.extension(file.path),
|
||||
);
|
||||
case target.FormatCheck.whitespace:
|
||||
return FileContentPair(
|
||||
content,
|
||||
whitespaceContentPair.formatted,
|
||||
path.extension(file.path),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@ -4,3 +4,7 @@ analyzer:
|
||||
exclude:
|
||||
# fixtures/ depends on dart:ui and raises false positives.
|
||||
- fixtures/**
|
||||
|
||||
linter:
|
||||
rules:
|
||||
unreachable_from_main: false # lint not compatible with how dart:ui is structured
|
||||
|
||||
@ -1501,7 +1501,7 @@ class Paint {
|
||||
}
|
||||
semicolon = '; ';
|
||||
}
|
||||
if (isAntiAlias != true) {
|
||||
if (!isAntiAlias) {
|
||||
result.write('${semicolon}antialias off');
|
||||
semicolon = '; ';
|
||||
}
|
||||
@ -6864,9 +6864,7 @@ base class _NativeImageDescriptor extends NativeFieldWrapperClass1 implements Im
|
||||
targetHeight = height;
|
||||
} else if (targetWidth == null && targetHeight != null) {
|
||||
targetWidth = (targetHeight * (width / height)).round();
|
||||
targetHeight = targetHeight;
|
||||
} else if (targetHeight == null && targetWidth != null) {
|
||||
targetWidth = targetWidth;
|
||||
targetHeight = targetWidth ~/ (width / height);
|
||||
}
|
||||
assert(targetWidth != null);
|
||||
|
||||
@ -113,9 +113,7 @@ CkImage scaleImage(SkImage image, int? targetWidth, int? targetHeight) {
|
||||
}
|
||||
if (targetWidth == null && targetHeight != null) {
|
||||
targetWidth = (targetHeight * (image.width() / image.height())).round();
|
||||
targetHeight = targetHeight;
|
||||
} else if (targetHeight == null && targetWidth != null) {
|
||||
targetWidth = targetWidth;
|
||||
targetHeight = targetWidth ~/ (image.width() / image.height());
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ class SurfacePaint implements ui.Paint {
|
||||
}
|
||||
semicolon = '; ';
|
||||
}
|
||||
if (isAntiAlias != true) {
|
||||
if (!isAntiAlias) {
|
||||
result.write('${semicolon}antialias off');
|
||||
semicolon = '; ';
|
||||
}
|
||||
|
||||
@ -553,7 +553,7 @@ class RecordingCanvas {
|
||||
return;
|
||||
}
|
||||
final RecordingCanvas pictureRecording = enginePicture.recordingCanvas!;
|
||||
if (pictureRecording._didDraw == true) {
|
||||
if (pictureRecording._didDraw) {
|
||||
_didDraw = true;
|
||||
}
|
||||
renderStrategy.merge(pictureRecording.renderStrategy);
|
||||
|
||||
@ -152,8 +152,6 @@ class SemanticsTextEditingStrategy extends DefaultTextEditingStrategy {
|
||||
{OnChangeCallback? onChange, OnActionCallback? onAction}) {
|
||||
isEnabled = true;
|
||||
inputConfiguration = inputConfig;
|
||||
onChange = onChange;
|
||||
onAction = onAction;
|
||||
applyConfiguration(inputConfig);
|
||||
}
|
||||
|
||||
|
||||
@ -1506,18 +1506,18 @@ abstract class DefaultTextEditingStrategy with CompositionAwareMixin implements
|
||||
/// see: https://bugs.chromium.org/p/chromium/issues/detail?id=119216#c11.
|
||||
void preventDefaultForMouseEvents() {
|
||||
subscriptions.add(
|
||||
DomSubscription(activeDomElement, 'mousedown', (_) {
|
||||
_.preventDefault();
|
||||
DomSubscription(activeDomElement, 'mousedown', (DomEvent event) {
|
||||
event.preventDefault();
|
||||
}));
|
||||
|
||||
subscriptions.add(
|
||||
DomSubscription(activeDomElement, 'mouseup', (_) {
|
||||
_.preventDefault();
|
||||
DomSubscription(activeDomElement, 'mouseup', (DomEvent event) {
|
||||
event.preventDefault();
|
||||
}));
|
||||
|
||||
subscriptions.add(
|
||||
DomSubscription(activeDomElement, 'mousemove', (_) {
|
||||
_.preventDefault();
|
||||
DomSubscription(activeDomElement, 'mousemove', (DomEvent event) {
|
||||
event.preventDefault();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,8 +8,6 @@ import 'package:ui/src/engine.dart';
|
||||
|
||||
import 'common.dart';
|
||||
|
||||
const MethodCodec codec = StandardMethodCodec();
|
||||
|
||||
void main() {
|
||||
internalBootstrapBrowserTest(() => testMain);
|
||||
}
|
||||
|
||||
@ -27,7 +27,6 @@ Map<String, dynamic> _tagStateWithSerialCount(dynamic state, int serialCount) {
|
||||
};
|
||||
}
|
||||
|
||||
const Map<String, bool> originState = <String, bool>{'origin': true};
|
||||
const Map<String, bool> flutterState = <String, bool>{'flutter': true};
|
||||
|
||||
const MethodCodec codec = JSONMethodCodec();
|
||||
|
||||
@ -11,7 +11,6 @@ import 'package:ui/ui.dart' as ui;
|
||||
|
||||
import '../common/keyboard_test_common.dart';
|
||||
|
||||
const int kLocationStandard = 0;
|
||||
const int kLocationLeft = 1;
|
||||
const int kLocationRight = 2;
|
||||
const int kLocationNumpad = 3;
|
||||
@ -25,7 +24,6 @@ final int kPhysicalNumpad1 = kWebToPhysicalKey['Numpad1']!;
|
||||
final int kPhysicalShiftLeft = kWebToPhysicalKey['ShiftLeft']!;
|
||||
final int kPhysicalShiftRight = kWebToPhysicalKey['ShiftRight']!;
|
||||
final int kPhysicalMetaLeft = kWebToPhysicalKey['MetaLeft']!;
|
||||
final int kPhysicalTab = kWebToPhysicalKey['Tab']!;
|
||||
final int kPhysicalCapsLock = kWebToPhysicalKey['CapsLock']!;
|
||||
final int kPhysicalScrollLock = kWebToPhysicalKey['ScrollLock']!;
|
||||
// A web-specific physical key when code is empty.
|
||||
@ -41,12 +39,9 @@ final int kLogicalShiftRight = kWebLogicalLocationMap['Shift']![kLocationRight]!
|
||||
final int kLogicalCtrlLeft = kWebLogicalLocationMap['Control']![kLocationLeft]!;
|
||||
final int kLogicalAltLeft = kWebLogicalLocationMap['Alt']![kLocationLeft]!;
|
||||
final int kLogicalMetaLeft = kWebLogicalLocationMap['Meta']![kLocationLeft]!;
|
||||
const int kLogicalTab = 0x0000000009;
|
||||
final int kLogicalCapsLock = kWebToLogicalKey['CapsLock']!;
|
||||
final int kLogicalScrollLock = kWebToLogicalKey['ScrollLock']!;
|
||||
|
||||
typedef VoidCallback = void Function();
|
||||
|
||||
void main() {
|
||||
internalBootstrapBrowserTest(() => testMain);
|
||||
}
|
||||
@ -1151,11 +1146,6 @@ MockKeyboardEvent keyRepeatedDownEvent(String code, String key, [int modifiers =
|
||||
);
|
||||
}
|
||||
|
||||
// Flags used for the `activeLocks` argument of expectKeyData.
|
||||
const int kCapsLock = 0x1;
|
||||
const int kNumlLock = 0x2;
|
||||
const int kScrollLock = 0x4;
|
||||
|
||||
void expectKeyData(
|
||||
ui.KeyData target, {
|
||||
required ui.KeyEventType type,
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:test/bootstrap/browser.dart';
|
||||
import 'package:test/test.dart';
|
||||
@ -16,8 +15,6 @@ const engine.MethodCodec codec = engine.JSONMethodCodec();
|
||||
engine.EngineFlutterWindow get implicitView =>
|
||||
engine.EnginePlatformDispatcher.instance.implicitView!;
|
||||
|
||||
void emptyCallback(ByteData date) {}
|
||||
|
||||
void main() {
|
||||
internalBootstrapBrowserTest(() => testMain);
|
||||
}
|
||||
|
||||
@ -13,8 +13,6 @@ import 'package:ui/ui_web/src/ui_web.dart' as ui_web;
|
||||
import '../common/matchers.dart';
|
||||
import 'history_test.dart';
|
||||
|
||||
const MethodCodec codec = JSONMethodCodec();
|
||||
|
||||
Map<String, dynamic> _tagStateWithSerialCount(dynamic state, int serialCount) {
|
||||
return <String, dynamic> {
|
||||
'serialCount': serialCount,
|
||||
|
||||
@ -12,7 +12,6 @@ import 'package:ui/src/engine.dart';
|
||||
import '../../common/test_initialization.dart';
|
||||
|
||||
EngineSemantics semantics() => EngineSemantics.instance;
|
||||
EngineSemanticsOwner owner() => EnginePlatformDispatcher.instance.implicitView!.semantics;
|
||||
|
||||
void main() {
|
||||
internalBootstrapBrowserTest(() {
|
||||
|
||||
@ -3137,14 +3137,3 @@ Future<void> createPlatformView(int id, String viewType) {
|
||||
);
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
/// Disposes of the platform view with the given [id].
|
||||
Future<void> disposePlatformView(int id) {
|
||||
final Completer<void> completer = Completer<void>();
|
||||
ui.PlatformDispatcher.instance.sendPlatformMessage(
|
||||
'flutter/platform_views',
|
||||
codec.encodeMethodCall(MethodCall('dispose', id)),
|
||||
(dynamic _) => completer.complete(),
|
||||
);
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
@ -54,20 +54,18 @@ void testMain() {
|
||||
|
||||
test('moveto/lineto convexity', () {
|
||||
final List<LineTestCase> testCases = <LineTestCase>[
|
||||
LineTestCase('', SPathConvexityType.kConvex, SPathDirection.kUnknown),
|
||||
LineTestCase('', SPathConvexityType.kConvex),
|
||||
LineTestCase(
|
||||
'0 0', SPathConvexityType.kConvex, SPathDirection.kUnknown),
|
||||
'0 0', SPathConvexityType.kConvex),
|
||||
LineTestCase(
|
||||
'0 0 10 10', SPathConvexityType.kConvex, SPathDirection.kUnknown),
|
||||
LineTestCase('0 0 10 10 20 20 0 0 10 10', SPathConvexityType.kConcave,
|
||||
SPathDirection.kUnknown),
|
||||
'0 0 10 10', SPathConvexityType.kConvex),
|
||||
LineTestCase('0 0 10 10 20 20 0 0 10 10', SPathConvexityType.kConcave),
|
||||
LineTestCase(
|
||||
'0 0 10 10 10 20', SPathConvexityType.kConvex, SPathDirection.kCW),
|
||||
'0 0 10 10 10 20', SPathConvexityType.kConvex),
|
||||
LineTestCase(
|
||||
'0 0 10 10 10 0', SPathConvexityType.kConvex, SPathDirection.kCCW),
|
||||
LineTestCase('0 0 10 10 10 0 0 10', SPathConvexityType.kConcave, null),
|
||||
LineTestCase('0 0 10 0 0 10 -10 -10', SPathConvexityType.kConcave,
|
||||
SPathDirection.kCW),
|
||||
'0 0 10 10 10 0', SPathConvexityType.kConvex),
|
||||
LineTestCase('0 0 10 10 10 0 0 10', SPathConvexityType.kConcave),
|
||||
LineTestCase('0 0 10 0 0 10 -10 -10', SPathConvexityType.kConcave),
|
||||
];
|
||||
|
||||
for (final LineTestCase testCase in testCases) {
|
||||
@ -418,10 +416,9 @@ void testMain() {
|
||||
}
|
||||
|
||||
class LineTestCase {
|
||||
LineTestCase(this.pathContent, this.convexity, this.direction);
|
||||
LineTestCase(this.pathContent, this.convexity);
|
||||
final String pathContent;
|
||||
final int convexity;
|
||||
final int? direction;
|
||||
}
|
||||
|
||||
/// Parses a string of the format "mx my lx1 ly1 lx2 ly2..." into a path
|
||||
|
||||
@ -14,10 +14,6 @@ import '../../common/matchers.dart';
|
||||
import '../../common/test_initialization.dart';
|
||||
|
||||
const MethodCodec codec = StandardMethodCodec();
|
||||
final EngineFlutterWindow window = EngineFlutterView.implicit(
|
||||
EnginePlatformDispatcher.instance,
|
||||
createDomHTMLDivElement(),
|
||||
);
|
||||
|
||||
void main() {
|
||||
internalBootstrapBrowserTest(() => testMain);
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:js_util' as js_util;
|
||||
|
||||
import 'package:test/bootstrap/browser.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:ui/src/engine.dart';
|
||||
@ -126,21 +124,3 @@ Picture _drawBackground() {
|
||||
..color = const Color(0xFFE0FFE0)) as SurfacePaint);
|
||||
return recorder.endRecording();
|
||||
}
|
||||
|
||||
HtmlImage createTestImage({int width = 200, int height = 150}) {
|
||||
final DomCanvasElement canvas =
|
||||
createDomCanvasElement(width: width, height: height);
|
||||
final DomCanvasRenderingContext2D ctx = canvas.context2D;
|
||||
ctx.fillStyle = '#E04040';
|
||||
ctx.fillRect(0, 0, width / 3, height);
|
||||
ctx.fill();
|
||||
ctx.fillStyle = '#40E080';
|
||||
ctx.fillRect(width / 3, 0, width / 3, height);
|
||||
ctx.fill();
|
||||
ctx.fillStyle = '#2040E0';
|
||||
ctx.fillRect(2 * width / 3, 0, width / 3, height);
|
||||
ctx.fill();
|
||||
final DomHTMLImageElement imageElement = createDomHTMLImageElement();
|
||||
imageElement.src = js_util.callMethod<String>(canvas, 'toDataURL', <dynamic>[]);
|
||||
return HtmlImage(imageElement, width, height);
|
||||
}
|
||||
|
||||
@ -136,8 +136,6 @@ Picture _drawGreenRectIntoPicture() {
|
||||
return recorder.endRecording();
|
||||
}
|
||||
|
||||
typedef PaintCallback = void Function(RecordingCanvas canvas);
|
||||
|
||||
const String _base64Encoded20x20TestImage =
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAC4jAAAuIwF4pT92AAAA'
|
||||
'B3RJTUUH5AMFFBksg4i3gQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAj'
|
||||
|
||||
@ -14,7 +14,6 @@ import 'text_goldens.dart';
|
||||
const String threeLines = 'First\nSecond\nThird';
|
||||
const String veryLong =
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
|
||||
const String longUnbreakable = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
|
||||
|
||||
void main() {
|
||||
internalBootstrapBrowserTest(() => testMain);
|
||||
|
||||
@ -230,13 +230,4 @@ class ArcSample {
|
||||
clockwise: clockwise);
|
||||
return path;
|
||||
}
|
||||
|
||||
// Returns bounds of start/end point of arc.
|
||||
Rect getBounds() {
|
||||
final Offset startP =
|
||||
Offset(75 - distance + offset.dx, 75 - distance + offset.dy);
|
||||
final Offset endP =
|
||||
Offset(75.0 + distance + offset.dx, 75.0 + distance + offset.dy);
|
||||
return Rect.fromLTRB(startP.dx, startP.dy, endP.dx, endP.dy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,7 +452,6 @@ void testMain() {
|
||||
}, skip: domIntl.v8BreakIterator == null);
|
||||
}
|
||||
|
||||
typedef CreateLineBreakFragmenter = LineBreakFragmenter Function(String text);
|
||||
typedef GroupBody = void Function({required bool isV8});
|
||||
|
||||
void groupForEachFragmenter(GroupBody callback) {
|
||||
|
||||
@ -530,8 +530,3 @@ Image _createBlueGreenImageSync() {
|
||||
picture.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore invalid utf8 since file is not actually text.
|
||||
String readAsStringLossy(File file) {
|
||||
return convert.utf8.decode(file.readAsBytesSync(), allowMalformed: true);
|
||||
}
|
||||
|
||||
@ -27,13 +27,6 @@ const List<double> grayscaleColorMatrix = <double>[
|
||||
0, 0, 0, 1, 0,
|
||||
];
|
||||
|
||||
const List<double> identityColorMatrix = <double>[
|
||||
1, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0,
|
||||
0, 0, 1, 0, 0,
|
||||
0, 0, 0, 1, 0,
|
||||
];
|
||||
|
||||
const List<double> constValueColorMatrix = <double>[
|
||||
0, 0, 0, 0, 2,
|
||||
0, 0, 0, 0, 2,
|
||||
|
||||
@ -17,8 +17,6 @@ class Foo {
|
||||
double getDouble() => 1.0;
|
||||
}
|
||||
|
||||
const Foo foo = Foo();
|
||||
|
||||
void main() {
|
||||
test('PluginUtilities Callback Handles', () {
|
||||
// Top level callback.
|
||||
|
||||
@ -194,16 +194,15 @@ int _checkLinux(String outPath, String nmPath, Iterable<String> builds) {
|
||||
}
|
||||
|
||||
class NmEntry {
|
||||
NmEntry._(this.address, this.type, this.name);
|
||||
NmEntry._(this.type, this.name);
|
||||
|
||||
final String address;
|
||||
final String type;
|
||||
final String name;
|
||||
|
||||
static Iterable<NmEntry> parse(String stdout) {
|
||||
return LineSplitter.split(stdout).map((String line) {
|
||||
final List<String> parts = line.split(' ');
|
||||
return NmEntry._(parts[0], parts[1], parts.last);
|
||||
return NmEntry._(parts[1], parts.last);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ final class Fixture {
|
||||
errSink: errBuffer,
|
||||
processManager: processManager,
|
||||
engine: engine,
|
||||
), errBuffer, outBuffer);
|
||||
), errBuffer);
|
||||
}
|
||||
|
||||
/// Simulates running the tool with the given [options].
|
||||
@ -49,21 +49,17 @@ final class Fixture {
|
||||
outSink: outBuffer,
|
||||
errSink: errBuffer,
|
||||
processManager: processManager,
|
||||
), errBuffer, outBuffer);
|
||||
), errBuffer);
|
||||
}
|
||||
|
||||
Fixture._(
|
||||
this.tool,
|
||||
this.errBuffer,
|
||||
this.outBuffer,
|
||||
);
|
||||
|
||||
/// The `clang-tidy` tool.
|
||||
final ClangTidy tool;
|
||||
|
||||
/// Captured `stdout` from the tool.
|
||||
final StringBuffer outBuffer;
|
||||
|
||||
/// Captured `stderr` from the tool.
|
||||
final StringBuffer errBuffer;
|
||||
}
|
||||
|
||||
@ -45,7 +45,6 @@ void expectInstances(dynamic value, dynamic expected, Compiler compiler) {
|
||||
// This test is assuming the `dart` used to invoke the tests is compatible
|
||||
// with the version of package:kernel in //third-party/dart/pkg/kernel
|
||||
final String dart = Platform.resolvedExecutable;
|
||||
final String bat = Platform.isWindows ? '.bat' : '';
|
||||
|
||||
void _checkRecursion(String dillPath, Compiler compiler) {
|
||||
stdout.writeln('Checking recursive calls.');
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
|
||||
class Box {
|
||||
const Box(this.content1, this.content2);
|
||||
final Object? content1;
|
||||
final Object? content2;
|
||||
final Object? content1; // ignore: unreachable_from_main
|
||||
final Object? content2; // ignore: unreachable_from_main
|
||||
}
|
||||
|
||||
const Box box1_0 = Box(null, null);
|
||||
|
||||
@ -19,7 +19,7 @@ Target helper(Target Function(String, int, Target?) tearOff) {
|
||||
class Targets {
|
||||
static const Target used1 = Target('used1', 1, null);
|
||||
static const Target used2 = Target('used2', 2, null);
|
||||
static const Target unused1 = Target('unused1', 1, null);
|
||||
static const Target unused1 = Target('unused1', 1, null); // ignore: unreachable_from_main
|
||||
}
|
||||
|
||||
// const_finder explicitly does not retain constants appearing within a class
|
||||
|
||||
@ -608,24 +608,6 @@ class _RepositoryIcuLicenseFile extends _RepositorySingleLicenseFile {
|
||||
}
|
||||
}
|
||||
|
||||
Iterable<List<int>> splitIntList(List<int> data, int boundary) sync* {
|
||||
int index = 0;
|
||||
List<int> getOne() {
|
||||
final int start = index;
|
||||
int end = index;
|
||||
while ((end < data.length) && (data[end] != boundary)) {
|
||||
end += 1;
|
||||
}
|
||||
end += 1;
|
||||
index = end;
|
||||
return data.sublist(start, end).toList();
|
||||
}
|
||||
|
||||
while (index < data.length) {
|
||||
yield getOne();
|
||||
}
|
||||
}
|
||||
|
||||
class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile {
|
||||
_RepositoryCxxStlDualLicenseFile(super.parent, super.io)
|
||||
: _licenses = _parseLicenses(io);
|
||||
|
||||
@ -199,17 +199,14 @@ final class Fixture {
|
||||
verbose: verbose,
|
||||
),
|
||||
logSink: logSink,
|
||||
processManager: processManager,
|
||||
);
|
||||
}
|
||||
|
||||
const Fixture._({
|
||||
required this.gitRepo,
|
||||
required this.logSink,
|
||||
required this.processManager,
|
||||
});
|
||||
|
||||
final GitRepo gitRepo;
|
||||
final StringBuffer logSink;
|
||||
final FakeProcessManager processManager;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user