stadium_border_test.dart 20.5 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5 6 7 8 9 10
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/painting.dart';
import 'package:flutter_test/flutter_test.dart';

import 'common_matchers.dart';

void main() {
11 12 13 14 15 16 17 18 19 20 21 22
  test('StadiumBorder defaults', () {
    const StadiumBorder border = StadiumBorder();
    expect(border.side, BorderSide.none);
  });

  test('StadiumBorder copyWith, ==, hashCode', () {
    expect(const StadiumBorder(), const StadiumBorder().copyWith());
    expect(const StadiumBorder().hashCode, const StadiumBorder().copyWith().hashCode);
    const BorderSide side = BorderSide(width: 10.0, color: Color(0xff123456));
    expect(const StadiumBorder().copyWith(side: side), const StadiumBorder(side: side));
  });

23
  test('StadiumBorder', () {
24 25 26
    const StadiumBorder c10 = StadiumBorder(side: BorderSide(width: 10.0));
    const StadiumBorder c15 = StadiumBorder(side: BorderSide(width: 15.0));
    const StadiumBorder c20 = StadiumBorder(side: BorderSide(width: 20.0));
27 28 29 30 31 32 33
    expect(c10.dimensions, const EdgeInsets.all(10.0));
    expect(c10.scale(2.0), c20);
    expect(c20.scale(0.5), c10);
    expect(ShapeBorder.lerp(c10, c20, 0.0), c10);
    expect(ShapeBorder.lerp(c10, c20, 0.5), c15);
    expect(ShapeBorder.lerp(c10, c20, 1.0), c20);

34
    const StadiumBorder c1 = StadiumBorder(side: BorderSide());
35
    expect(c1.getOuterPath(Rect.fromCircle(center: Offset.zero, radius: 1.0)), isUnitCircle);
36
    const StadiumBorder c2 = StadiumBorder(side: BorderSide());
37
    expect(c2.getInnerPath(Rect.fromCircle(center: Offset.zero, radius: 2.0)), isUnitCircle);
Dan Field's avatar
Dan Field committed
38
    const Rect rect = Rect.fromLTRB(10.0, 20.0, 100.0, 200.0);
39 40 41 42
    expect(
            (Canvas canvas) => c10.paint(canvas, rect),
        paints
          ..rrect(
43
            rrect: RRect.fromRectAndRadius(rect.deflate(5.0), Radius.circular(rect.shortestSide / 2.0 - 5.0)),
44
            strokeWidth: 10.0,
45
          ),
46 47 48
    );
  });

49
  test('StadiumBorder with StrokeAlign', () {
50 51
    const StadiumBorder center = StadiumBorder(side: BorderSide(width: 10.0, strokeAlign: BorderSide.strokeAlignCenter));
    const StadiumBorder outside = StadiumBorder(side: BorderSide(width: 10.0, strokeAlign: BorderSide.strokeAlignOutside));
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
    expect(center.dimensions, const EdgeInsets.all(5.0));
    expect(outside.dimensions, EdgeInsets.zero);

    const Rect rect = Rect.fromLTRB(10.0, 20.0, 100.0, 200.0);

    expect(
      (Canvas canvas) => center.paint(canvas, rect),
      paints
        ..rrect(
          rrect: RRect.fromRectAndRadius(rect, Radius.circular(rect.shortestSide / 2.0)),
          strokeWidth: 10.0,
        ),
    );

    expect(
      (Canvas canvas) => outside.paint(canvas, rect),
      paints
        ..rrect(
          rrect: RRect.fromRectAndRadius(rect, Radius.circular(rect.shortestSide / 2.0)).inflate(5.0),
          strokeWidth: 10.0,
        ),
    );
  });

76
  test('StadiumBorder and CircleBorder', () {
77 78
    const StadiumBorder stadium = StadiumBorder();
    const CircleBorder circle = CircleBorder();
Dan Field's avatar
Dan Field committed
79
    const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 20.0);
80
    final Matcher looksLikeS = isPathThat(
81 82
      includes: const <Offset>[ Offset(30.0, 10.0), Offset(50.0, 10.0), ],
      excludes: const <Offset>[ Offset(1.0, 1.0), Offset(99.0, 19.0), ],
83 84
    );
    final Matcher looksLikeC = isPathThat(
85 86
      includes: const <Offset>[ Offset(50.0, 10.0), ],
      excludes: const <Offset>[ Offset(1.0, 1.0), Offset(30.0, 10.0), Offset(99.0, 19.0), ],
87 88 89
    );
    expect(stadium.getOuterPath(rect), looksLikeS);
    expect(circle.getOuterPath(rect), looksLikeC);
90 91 92 93 94 95 96 97 98 99 100 101
    expect(ShapeBorder.lerp(stadium, circle, 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(stadium, circle, 0.9)!.getOuterPath(rect), looksLikeC);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.9), stadium, 0.1)!.getOuterPath(rect), looksLikeC);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.9), stadium, 0.9)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), circle, 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), circle, 0.9)!.getOuterPath(rect), looksLikeC);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.9), 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.9), 0.9)!.getOuterPath(rect), looksLikeC);
    expect(ShapeBorder.lerp(stadium, ShapeBorder.lerp(stadium, circle, 0.9), 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(stadium, ShapeBorder.lerp(stadium, circle, 0.9), 0.9)!.getOuterPath(rect), looksLikeC);
    expect(ShapeBorder.lerp(circle, ShapeBorder.lerp(stadium, circle, 0.1), 0.1)!.getOuterPath(rect), looksLikeC);
    expect(ShapeBorder.lerp(circle, ShapeBorder.lerp(stadium, circle, 0.1), 0.9)!.getOuterPath(rect), looksLikeS);
102

103 104
    expect(
      ShapeBorder.lerp(stadium, circle, 0.1).toString(),
105
      'StadiumBorder(BorderSide(width: 0.0, style: none), 10.0% of the way to being a CircleBorder)',
106 107 108
    );
    expect(
      ShapeBorder.lerp(stadium, circle, 0.2).toString(),
109
      'StadiumBorder(BorderSide(width: 0.0, style: none), 20.0% of the way to being a CircleBorder)',
110 111 112
    );
    expect(
      ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.9), 0.9).toString(),
113
      'StadiumBorder(BorderSide(width: 0.0, style: none), 82.0% of the way to being a CircleBorder)',
114 115 116 117
    );

    expect(
      ShapeBorder.lerp(circle, stadium, 0.9).toString(),
118
      'StadiumBorder(BorderSide(width: 0.0, style: none), 10.0% of the way to being a CircleBorder)',
119 120 121
    );
    expect(
      ShapeBorder.lerp(circle, stadium, 0.8).toString(),
122
      'StadiumBorder(BorderSide(width: 0.0, style: none), 20.0% of the way to being a CircleBorder)',
123 124 125
    );
    expect(
      ShapeBorder.lerp(ShapeBorder.lerp(stadium, circle, 0.9), ShapeBorder.lerp(stadium, circle, 0.1), 0.1).toString(),
126
      'StadiumBorder(BorderSide(width: 0.0, style: none), 82.0% of the way to being a CircleBorder)',
127
    );
128 129 130 131

    expect(ShapeBorder.lerp(stadium, circle, 0.1), ShapeBorder.lerp(stadium, circle, 0.1));
    expect(ShapeBorder.lerp(stadium, circle, 0.1).hashCode, ShapeBorder.lerp(stadium, circle, 0.1).hashCode);

132 133
    final ShapeBorder direct50 = ShapeBorder.lerp(stadium, circle, 0.5)!;
    final ShapeBorder indirect50 = ShapeBorder.lerp(ShapeBorder.lerp(circle, stadium, 0.1), ShapeBorder.lerp(circle, stadium, 0.9), 0.5)!;
134 135 136
    expect(direct50, indirect50);
    expect(direct50.hashCode, indirect50.hashCode);
    expect(direct50.toString(), indirect50.toString());
137
  });
138

139
  test('StadiumBorder and RoundedRectBorder with BorderRadius.zero', () {
140 141
    const StadiumBorder stadium = StadiumBorder();
    const RoundedRectangleBorder rrect = RoundedRectangleBorder();
Dan Field's avatar
Dan Field committed
142
    const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 50.0);
143 144
    final Matcher looksLikeS = isPathThat(
      includes: const <Offset>[
145 146 147
        Offset(25.0, 25.0),
        Offset(50.0, 25.0),
        Offset(7.33, 7.33),
148 149
      ],
      excludes: const <Offset>[
150 151 152 153
        Offset(0.001, 0.001),
        Offset(99.999, 0.001),
        Offset(99.999, 49.999),
        Offset(0.001, 49.999),
154 155 156 157
      ],
    );
    final Matcher looksLikeR = isPathThat(
      includes: const <Offset>[
158 159 160 161 162 163 164
        Offset(25.0, 25.0),
        Offset(50.0, 25.0),
        Offset(7.33, 7.33),
        Offset(4.0, 4.0),
        Offset(96.0, 4.0),
        Offset(96.0, 46.0),
        Offset(4.0, 46.0),
165 166 167 168
      ],
    );
    expect(stadium.getOuterPath(rect), looksLikeS);
    expect(rrect.getOuterPath(rect), looksLikeR);
169 170 171 172 173 174 175 176 177 178 179 180
    expect(ShapeBorder.lerp(stadium, rrect, 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(stadium, rrect, 0.9)!.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), stadium, 0.1)!.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), stadium, 0.9)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), rrect, 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), rrect, 0.9)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9)!.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(stadium, ShapeBorder.lerp(stadium, rrect, 0.9), 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(stadium, ShapeBorder.lerp(stadium, rrect, 0.9), 0.9)!.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.9)!.getOuterPath(rect), looksLikeS);
181

182 183
    expect(
      ShapeBorder.lerp(stadium, rrect, 0.1).toString(),
184
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
185 186 187 188
      'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(stadium, rrect, 0.2).toString(),
189
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
190 191 192 193
      'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9).toString(),
194
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
195 196 197 198 199
      'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)',
    );

    expect(
      ShapeBorder.lerp(rrect, stadium, 0.9).toString(),
200
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
201 202 203 204
      'BorderRadius.zero, 10.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(rrect, stadium, 0.8).toString(),
205
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
206 207 208 209
      'BorderRadius.zero, 20.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), ShapeBorder.lerp(stadium, rrect, 0.1), 0.1).toString(),
210
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
211 212
      'BorderRadius.zero, 82.0% of the way to being a RoundedRectangleBorder)',
    );
213 214 215 216

    expect(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.1));
    expect(ShapeBorder.lerp(stadium, rrect, 0.1).hashCode, ShapeBorder.lerp(stadium, rrect, 0.1).hashCode);

217 218
    final ShapeBorder direct50 = ShapeBorder.lerp(stadium, rrect, 0.5)!;
    final ShapeBorder indirect50 = ShapeBorder.lerp(ShapeBorder.lerp(rrect, stadium, 0.1), ShapeBorder.lerp(rrect, stadium, 0.9), 0.5)!;
219 220 221 222
    expect(direct50, indirect50);
    expect(direct50.hashCode, indirect50.hashCode);
    expect(direct50.toString(), indirect50.toString());
  });
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402

  test('StadiumBorder and RoundedRectBorder with circular BorderRadius', () {
    const StadiumBorder stadium = StadiumBorder();
    const RoundedRectangleBorder rrect = RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10)));
    const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 50.0);
    final Matcher looksLikeS = isPathThat(
      includes: const <Offset>[
        Offset(25.0, 25.0),
        Offset(50.0, 25.0),
        Offset(7.33, 7.33),
      ],
      excludes: const <Offset>[
        Offset(0.001, 0.001),
        Offset(99.999, 0.001),
        Offset(99.999, 49.999),
        Offset(0.001, 49.999),
      ],
    );
    final Matcher looksLikeR = isPathThat(
      includes: const <Offset>[
        Offset(25.0, 25.0),
        Offset(50.0, 25.0),
        Offset(7.33, 7.33),
        Offset(4.0, 4.0),
        Offset(96.0, 4.0),
        Offset(96.0, 46.0),
        Offset(4.0, 46.0),
      ],
    );
    expect(stadium.getOuterPath(rect), looksLikeS);
    expect(rrect.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(stadium, rrect, 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(stadium, rrect, 0.9)!.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), stadium, 0.1)!.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), stadium, 0.9)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), rrect, 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), rrect, 0.9)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9)!.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(stadium, ShapeBorder.lerp(stadium, rrect, 0.9), 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(stadium, ShapeBorder.lerp(stadium, rrect, 0.9), 0.9)!.getOuterPath(rect), looksLikeR);
    expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.1)!.getOuterPath(rect), looksLikeS);
    expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.9)!.getOuterPath(rect), looksLikeS);

    expect(
      ShapeBorder.lerp(stadium, rrect, 0.1).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadius.circular(10.0), 10.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(stadium, rrect, 0.2).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadius.circular(10.0), 20.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadius.circular(10.0), 82.0% of the way to being a RoundedRectangleBorder)',
    );

    expect(
      ShapeBorder.lerp(rrect, stadium, 0.9).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadius.circular(10.0), 10.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(rrect, stadium, 0.8).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadius.circular(10.0), 20.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), ShapeBorder.lerp(stadium, rrect, 0.1), 0.1).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadius.circular(10.0), 82.0% of the way to being a RoundedRectangleBorder)',
    );

    expect(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.1));
    expect(ShapeBorder.lerp(stadium, rrect, 0.1).hashCode, ShapeBorder.lerp(stadium, rrect, 0.1).hashCode);

    final ShapeBorder direct50 = ShapeBorder.lerp(stadium, rrect, 0.5)!;
    final ShapeBorder indirect50 = ShapeBorder.lerp(ShapeBorder.lerp(rrect, stadium, 0.1), ShapeBorder.lerp(rrect, stadium, 0.9), 0.5)!;
    expect(direct50, indirect50);
    expect(direct50.hashCode, indirect50.hashCode);
    expect(direct50.toString(), indirect50.toString());
  });

  test('StadiumBorder and RoundedRectBorder with BorderRadiusDirectional', () {
    const StadiumBorder stadium = StadiumBorder();
    const RoundedRectangleBorder rrect = RoundedRectangleBorder(
      borderRadius: BorderRadiusDirectional.only(
        topStart: Radius.circular(10),
        bottomEnd: Radius.circular(10),
        ),
      );
    const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 50.0);
    final Matcher looksLikeS = isPathThat(
      includes: const <Offset>[
        Offset(25.0, 25.0),
        Offset(50.0, 25.0),
        Offset(7.33, 7.33),
      ],
      excludes: const <Offset>[
        Offset(0.001, 0.001),
        Offset(99.999, 0.001),
        Offset(99.999, 49.999),
        Offset(0.001, 49.999),
      ],
    );
    final Matcher looksLikeR = isPathThat(
      includes: const <Offset>[
        Offset(25.0, 25.0),
        Offset(50.0, 25.0),
        Offset(7.33, 7.33),
        Offset(4.0, 4.0),
        Offset(96.0, 4.0),
        Offset(96.0, 46.0),
        Offset(4.0, 46.0),
      ],
    );
    expect(stadium.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);
    expect(rrect.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeR);
    expect(ShapeBorder.lerp(stadium, rrect, 0.1)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);
    expect(ShapeBorder.lerp(stadium, rrect, 0.9)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeR);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), stadium, 0.1)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeR);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), stadium, 0.9)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), rrect, 0.1)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), rrect, 0.9)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.1)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);
    expect(ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeR);
    expect(ShapeBorder.lerp(stadium, ShapeBorder.lerp(stadium, rrect, 0.9), 0.1)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);
    expect(ShapeBorder.lerp(stadium, ShapeBorder.lerp(stadium, rrect, 0.9), 0.9)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeR);
    expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.1)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);
    expect(ShapeBorder.lerp(rrect, ShapeBorder.lerp(stadium, rrect, 0.1), 0.9)!.getOuterPath(rect, textDirection: TextDirection.rtl), looksLikeS);

    expect(
      ShapeBorder.lerp(stadium, rrect, 0.1).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadiusDirectional.only(topStart: Radius.circular(10.0), '
      'bottomEnd: Radius.circular(10.0)), 10.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(stadium, rrect, 0.2).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadiusDirectional.only(topStart: Radius.circular(10.0), '
      'bottomEnd: Radius.circular(10.0)), 20.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.9), 0.9).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadiusDirectional.only(topStart: Radius.circular(10.0), '
      'bottomEnd: Radius.circular(10.0)), 82.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(rrect, stadium, 0.9).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadiusDirectional.only(topStart: Radius.circular(10.0), '
      'bottomEnd: Radius.circular(10.0)), 10.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(rrect, stadium, 0.8).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadiusDirectional.only(topStart: Radius.circular(10.0), '
      'bottomEnd: Radius.circular(10.0)), 20.0% of the way to being a RoundedRectangleBorder)',
    );
    expect(
      ShapeBorder.lerp(ShapeBorder.lerp(stadium, rrect, 0.9), ShapeBorder.lerp(stadium, rrect, 0.1), 0.1).toString(),
      'StadiumBorder(BorderSide(width: 0.0, style: none), '
      'BorderRadiusDirectional.only(topStart: Radius.circular(10.0), '
      'bottomEnd: Radius.circular(10.0)), 82.0% of the way to being a RoundedRectangleBorder)',
    );

    expect(ShapeBorder.lerp(stadium, rrect, 0.1), ShapeBorder.lerp(stadium, rrect, 0.1));
    expect(ShapeBorder.lerp(stadium, rrect, 0.1).hashCode, ShapeBorder.lerp(stadium, rrect, 0.1).hashCode);

    final ShapeBorder direct50 = ShapeBorder.lerp(stadium, rrect, 0.5)!;
    final ShapeBorder indirect50 = ShapeBorder.lerp(ShapeBorder.lerp(rrect, stadium, 0.1), ShapeBorder.lerp(rrect, stadium, 0.9), 0.5)!;
    expect(direct50, indirect50);
    expect(direct50.hashCode, indirect50.hashCode);
    expect(direct50.toString(), indirect50.toString());
  });
403
}