view_test_api.h 811 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_VIEWS_VIEW_TEST_API_H_
  5. #define UI_VIEWS_VIEW_TEST_API_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "ui/views/view.h"
  8. namespace views {
  9. class VIEWS_EXPORT ViewTestApi {
  10. public:
  11. explicit ViewTestApi(View* view) : view_(view) {}
  12. ViewTestApi(const ViewTestApi&) = delete;
  13. ViewTestApi& operator=(const ViewTestApi&) = delete;
  14. ~ViewTestApi() = default;
  15. bool needs_layout() { return view_->needs_layout(); }
  16. void ClearNeedsPaint() { view_->needs_paint_ = false; }
  17. bool needs_paint() const { return view_->needs_paint_; }
  18. private:
  19. raw_ptr<View> view_;
  20. };
  21. } // namespace views
  22. #endif // UI_VIEWS_VIEW_TEST_API_H_