chromium/ui/views/layout/layout_manager_base_unittest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/views/layout/layout_manager_base.h"

#include <algorithm>

#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/test/test_views.h"
#include "ui/views/test/views_test_utils.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"

namespace views {

namespace {

constexpr int kChildViewPadding =;
constexpr gfx::Size kMinimumSize(40, 50);
constexpr gfx::Size kPreferredSize(100, 90);
constexpr gfx::Size kSquarishSize(10, 11);
constexpr gfx::Size kLongSize(20, 8);
constexpr gfx::Size kTallSize(4, 22);
constexpr gfx::Size kLargeSize(30, 28);

// Dummy class that minimally implements LayoutManagerBase for basic
// functionality testing.
class TestLayoutManagerBase : public LayoutManagerBase {};

// This layout layout lays out included child views in the upper-left of the
// host view with kChildViewPadding around them. Views that will not fit are
// made invisible. Child views are expected to overlap as they all have the
// same top-left corner.
class MockLayoutManagerBase : public LayoutManagerBase {};

void ExpectSameViews(const std::vector<const View*>& expected,
                     const std::vector<const View*>& actual) {}

}  // namespace

TEST(LayoutManagerBaseTest, GetMinimumSize) {}

TEST(LayoutManagerBaseTest, GetPreferredSize) {}

TEST(LayoutManagerBaseTest, GetPreferredHeightForWidth) {}

TEST(LayoutManagerBaseTest, Installed) {}

TEST(LayoutManagerBaseTest, SetChildIncludedInLayout) {}

TEST(LayoutManagerBaseTest, InvalidateHost_NotInstalled) {}

TEST(LayoutManagerBaseTest, InvalidateHost_Installed) {}

// Test LayoutManager functionality of LayoutManagerBase:

namespace {

// Base for tests that evaluate the LayoutManager functionality of
// LayoutManagerBase (rather than the LayoutManagerBase-specific behavior).
class LayoutManagerBaseManagerTest : public testing::Test {};

}  // namespace

TEST_F(LayoutManagerBaseManagerTest, ProposedLayout_GetLayoutFor) {}

TEST_F(LayoutManagerBaseManagerTest, ApplyLayout) {}

TEST_F(LayoutManagerBaseManagerTest, ApplyLayout_SkipsOmittedViews) {}

TEST_F(LayoutManagerBaseManagerTest, Install) {}

TEST_F(LayoutManagerBaseManagerTest, GetMinimumSize) {}

TEST_F(LayoutManagerBaseManagerTest, GetPreferredSize) {}

TEST_F(LayoutManagerBaseManagerTest, GetPreferredHeightForWidth) {}

TEST_F(LayoutManagerBaseManagerTest, InvalidateLayout) {}

TEST_F(LayoutManagerBaseManagerTest, Layout) {}

TEST_F(LayoutManagerBaseManagerTest, IgnoresChildWithViewIgnoredByLayoutKey) {}

TEST_F(LayoutManagerBaseManagerTest, ViewVisibilitySet) {}

TEST_F(LayoutManagerBaseManagerTest, ViewAdded) {}

TEST_F(LayoutManagerBaseManagerTest, ViewAdded_NotVisible) {}

TEST_F(LayoutManagerBaseManagerTest, ViewRemoved) {}

class TestIgnoredView : public View {};

BEGIN_METADATA()

// An ignored view's visibility and layout are managed outside of the layout
// manager, whether that's in the view itself or in a manual layout method in
// its parent view.
TEST_F(LayoutManagerBaseManagerTest, IgnoredView) {}

TEST(LayoutManagerBase_ProposedLayoutTest, Equality) {}

class LayoutManagerBaseAvailableSizeTest : public testing::Test {};

TEST_F(LayoutManagerBaseAvailableSizeTest, ReturnsCorrectValues) {}

TEST_F(LayoutManagerBaseAvailableSizeTest, AvailableSizesInNestedValuesAdd) {}

TEST_F(LayoutManagerBaseAvailableSizeTest,
       PartiallySpecifiedAvailableSizesInNestedLayoutsAddPartially) {}

TEST_F(LayoutManagerBaseAvailableSizeTest,
       MismatchedAvailableSizesInNestedLayoutsDoNotAdd) {}

TEST_F(LayoutManagerBaseAvailableSizeTest,
       AvaialbleSizeChangeTriggersDescendantLayout) {}

ManualLayoutUtilTest;

TEST_F(ManualLayoutUtilTest, SetCanBeVisibleForManualLayout) {}

TEST_F(ManualLayoutUtilTest, TemporarilyExcludeOneViewFromLayout) {}

TEST_F(ManualLayoutUtilTest, TemporarilyExcludeTwoViewsFromLayout) {}

TEST_F(ManualLayoutUtilTest, ViewStaysExcludedIfAlreadyExcludedByProperty) {}

TEST_F(ManualLayoutUtilTest, ViewHiddenDuringTemporaryExclusion) {}

TEST_F(ManualLayoutUtilTest, ViewUnhiddenDuringTemporaryExclusion) {}

}  // namespace views