mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-15 03:04:25 +08:00
Add:创建 flutter go web 版
This commit is contained in:
45
packages/flutter_web/test/engine/rrect_test.dart
Normal file
45
packages/flutter_web/test/engine/rrect_test.dart
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_web/painting.dart';
|
||||
|
||||
import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
void main() {
|
||||
test('RRect.contains()', () {
|
||||
final RRect rrect = RRect.fromRectAndCorners(
|
||||
Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
|
||||
topLeft: const Radius.circular(0.5),
|
||||
topRight: const Radius.circular(0.25),
|
||||
bottomRight: const Radius.elliptical(0.25, 0.75),
|
||||
bottomLeft: Radius.zero);
|
||||
|
||||
expect(rrect.contains(const Offset(1.0, 1.0)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.1, 1.1)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.15, 1.15)), isTrue);
|
||||
expect(rrect.contains(const Offset(2.0, 1.0)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.93, 1.07)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.97, 1.7)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.7, 1.97)), isTrue);
|
||||
expect(rrect.contains(const Offset(1.0, 1.99)), isTrue);
|
||||
});
|
||||
|
||||
test('RRect.contains() large radii', () {
|
||||
final RRect rrect = RRect.fromRectAndCorners(
|
||||
Rect.fromLTRB(1.0, 1.0, 2.0, 2.0),
|
||||
topLeft: const Radius.circular(5000.0),
|
||||
topRight: const Radius.circular(2500.0),
|
||||
bottomRight: const Radius.elliptical(2500.0, 7500.0),
|
||||
bottomLeft: Radius.zero);
|
||||
|
||||
expect(rrect.contains(const Offset(1.0, 1.0)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.1, 1.1)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.15, 1.15)), isTrue);
|
||||
expect(rrect.contains(const Offset(2.0, 1.0)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.93, 1.07)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.97, 1.7)), isFalse);
|
||||
expect(rrect.contains(const Offset(1.7, 1.97)), isTrue);
|
||||
expect(rrect.contains(const Offset(1.0, 1.99)), isTrue);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user