blob: e8a14d7869b45de1c6bb18028540ebed0bb9ac34 [file] [log] [blame]
// Copyright 2014 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.
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
final MemoryAllocations ma = MemoryAllocations.instance;
setUp(() {
'$MemoryAllocations is noop when kFlutterMemoryAllocationsEnabled is false.',
(WidgetTester tester) async {
ObjectEvent? recievedEvent;
ObjectEvent listener(ObjectEvent event) => recievedEvent = event;
expect(ma.hasListeners, isFalse);
await _activateFlutterObjects(tester);
expect(recievedEvent, isNull);
expect(ma.hasListeners, isFalse);
class _TestRenderObject extends RenderObject {
void debugAssertDoesMeetConstraints() {}
Rect get paintBounds => throw UnimplementedError();
void performLayout() {}
void performResize() {}
Rect get semanticBounds => throw UnimplementedError();
class _TestLayer extends Layer{
void addToScene(SceneBuilder builder) {}
/// Create and dispose Flutter objects to fire memory allocation events.
Future<void> _activateFlutterObjects(WidgetTester tester) async {
final RenderObject renderObject = _TestRenderObject();
final Layer layer = _TestLayer();
// It is ok to use protected members for testing.
// ignore: invalid_use_of_protected_member, invalid_use_of_visible_for_testing_member