chromium/ui/views/controls/styled_label_unittest.cc

// Copyright 2013 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/controls/styled_label.h"

#include <stddef.h>

#include <memory>
#include <string>
#include <utility>

#include "base/command_line.h"
#include "base/functional/callback.h"
#include "base/i18n/base_i18n_switches.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/icu_test_util.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/text_constants.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/border.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/link_fragment.h"
#include "ui/views/style/typography.h"
#include "ui/views/test/test_layout_provider.h"
#include "ui/views/test/test_views.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/test/views_test_utils.h"
#include "ui/views/widget/widget.h"

ASCIIToUTF16;

namespace views {

namespace {

SizeIs;

Label* LabelAt(StyledLabel* styled,
               size_t index,
               std::string expected_classname = Label::kViewClassName) {}

int StyledLabelContentHeightForWidth(StyledLabel* styled, int w) {}

}  // namespace

class StyledLabelTest : public ViewsTestBase {};

class StyledLabelInWidgetTest : public ViewsTestBase {};

TEST_F(StyledLabelTest, NoWrapping) {}

TEST_F(StyledLabelTest, TrailingWhitespaceiIgnored) {}

TEST_F(StyledLabelTest, RespectLeadingWhitespace) {}

TEST_F(StyledLabelTest, RespectLeadingSpacesInNonFirstLine) {}

TEST_F(StyledLabelTest, CorrectWrapAtNewline) {}

TEST_F(StyledLabelTest, FirstLineNotEmptyWhenLeadingWhitespaceTooLong) {}

TEST_F(StyledLabelTest, BasicWrapping) {}

TEST_F(StyledLabelTest, AllowEmptyLines) {}

TEST_F(StyledLabelTest, WrapLongWords) {}

TEST_F(StyledLabelTest, CreateLinks) {}

TEST_F(StyledLabelTest, StyledRangeCustomFontUnderlined) {}

TEST_F(StyledLabelTest, StyledRangeTextStyleBold) {}

TEST_F(StyledLabelInWidgetTest, Color) {}

TEST_F(StyledLabelInWidgetTest, SetBackgroundColor) {}

TEST_F(StyledLabelInWidgetTest, SetBackgroundColorIdReactsToThemeChange) {}

TEST_F(StyledLabelTest, StyledRangeWithTooltip) {}

TEST_F(StyledLabelTest, SetTextContextAndDefaultStyle) {}

TEST_F(StyledLabelTest, LineHeight) {}

TEST_F(StyledLabelTest, LineHeightWithBorder) {}

TEST_F(StyledLabelTest, LineHeightWithLink) {}

TEST_F(StyledLabelTest, HandleEmptyLayout) {}

TEST_F(StyledLabelTest, CacheSize) {}

TEST_F(StyledLabelTest, Border) {}

TEST_F(StyledLabelTest, LineHeightWithShorterCustomView) {}

TEST_F(StyledLabelTest, LineHeightWithTallerCustomView) {}

TEST_F(StyledLabelTest, LineWrapperWithCustomView) {}

TEST_F(StyledLabelTest, AlignmentInLTR) {}

TEST_F(StyledLabelTest, AlignmentInRTL) {}

TEST_F(StyledLabelTest, ViewsCenteredWithLinkAndCustomView) {}

TEST_F(StyledLabelTest, ViewsCenteredForEvenAndOddSizes) {}

TEST_F(StyledLabelTest, CacheSizeWithAlignment) {}

// Verifies that calling SizeToFit() on a label which requires less width still
// causes it to take the whole requested width.
TEST_F(StyledLabelTest, SizeToFit) {}

// Verifies that a non-empty label has a preferred size by default.
TEST_F(StyledLabelTest, PreferredSizeNonEmpty) {}

// Verifies that GetPreferredSize() respects the existing wrapping.
TEST_F(StyledLabelTest, PreferredSizeRespectsWrapping) {}

// Verifies that calling a const method does not change the preferred size.
TEST_F(StyledLabelTest, PreferredSizeAcrossConstCall) {}

TEST_F(StyledLabelTest, AccessibleNameAndRole) {}

// Regression test for crbug.com/361639416.
// Tests that the child views (text fragments) are still alive after layout.
TEST_F(StyledLabelTest, OldChildViewsAreAliveAfterLayout) {}

}  // namespace views