blob: ccab201117af30adb199717122f4e4230e72b383 [file] [log] [blame]
// 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.
#include "flutter/display_list/display_list_utils.h"
#include "flutter/display_list/skia/dl_sk_utils.h"
#include "gtest/gtest.h"
namespace flutter {
namespace testing {
class MockDispatchHelper final : public virtual DlOpReceiver,
public SkPaintDispatchHelper,
public IgnoreClipDispatchHelper,
public IgnoreTransformDispatchHelper,
public IgnoreDrawDispatchHelper {
public:
void save() override { SkPaintDispatchHelper::save_opacity(0.5f); }
void restore() override { SkPaintDispatchHelper::restore_opacity(); }
};
// Regression test for https://github.com/flutter/flutter/issues/100176.
TEST(DisplayListUtils, OverRestore) {
MockDispatchHelper helper;
helper.save();
helper.restore();
// There should be a protection here for over-restore to keep the program from
// crashing.
helper.restore();
}
} // namespace testing
} // namespace flutter