chromium/third_party/blink/renderer/core/layout/text_autosizer_test.cc

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

#include "third_party/blink/renderer/core/layout/text_autosizer.h"

#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/viewport_data.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "ui/gfx/geometry/rect.h"

namespace blink {
class TextAutosizerClient : public RenderingTestChromeClient {};

class TextAutosizerTest : public RenderingTest,
                          public testing::WithParamInterface<bool>,
                          private ScopedTextSizeAdjustImprovementsForTest {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(TextAutosizerTest, SimpleParagraph) {}

TEST_P(TextAutosizerTest, TextSizeAdjustDisablesAutosizing) {}

TEST_P(TextAutosizerTest, ParagraphWithChangingTextSizeAdjustment) {}

TEST_P(TextAutosizerTest, ZeroTextSizeAdjustment) {}

TEST_P(TextAutosizerTest, NegativeTextSizeAdjustment) {}

TEST_P(TextAutosizerTest, TextSizeAdjustmentPixelUnits) {}

TEST_P(TextAutosizerTest, NestedTextSizeAdjust) {}

TEST_P(TextAutosizerTest, PrefixedTextSizeAdjustIsAlias) {}

TEST_P(TextAutosizerTest, AccessibilityFontScaleFactor) {}

TEST_P(TextAutosizerTest, AccessibilityFontScaleFactorWithTextSizeAdjustNone) {}

TEST_P(TextAutosizerTest, ChangingAccessibilityFontScaleFactor) {}

TEST_P(TextAutosizerTest, TextSizeAdjustDoesNotDisableAccessibility) {}

// https://crbug.com/646237
TEST_P(TextAutosizerTest, DISABLED_TextSizeAdjustWithoutNeedingAutosizing) {}

TEST_P(TextAutosizerTest, DeviceScaleAdjustmentWithViewport) {}

TEST_P(TextAutosizerTest, ChangingSuperClusterFirstText) {}

TEST_P(TextAutosizerTest, ChangingSuperClusterSecondText) {}

TEST_P(TextAutosizerTest, AddingSuperCluster) {}

TEST_P(TextAutosizerTest, ChangingInheritedClusterTextInsideSuperCluster) {}

TEST_P(TextAutosizerTest, AutosizeInnerContentOfRuby) {}

TEST_P(TextAutosizerTest, ResizeAndGlyphOverflowChanged) {}

TEST_P(TextAutosizerTest, narrowContentInsideNestedWideBlock) {}

TEST_P(TextAutosizerTest, LayoutViewWidthProvider) {}

TEST_P(TextAutosizerTest, MultiColumns) {}

TEST_P(TextAutosizerTest, MultiColumns2) {}

TEST_P(TextAutosizerTest, ScaledbyDSF) {}

TEST_P(TextAutosizerTest, ClusterHasNotEnoughTextToAutosizeForZoomDSF) {}

// TODO(jaebaek): Unit tests ClusterHasNotEnoughTextToAutosizeForZoomDSF and
// ClusterHasEnoughTextToAutosizeForZoomDSF must be updated.
// The return value of TextAutosizer::ClusterHasEnoughTextToAutosize() must not
// be the same regardless of DSF. In real world
// TextAutosizer::ClusterHasEnoughTextToAutosize(),
// minimum_text_length_to_autosize is in physical pixel scale. However, in
// these unit tests, it is in DIP scale, which makes
// ClusterHasEnoughTextToAutosizeForZoomDSF not fail. We need a trick to update
// the minimum_text_length_to_autosize in these unit test and check the return
// value change of TextAutosizer::ClusterHasEnoughTextToAutosize() depending on
// the length of text even when DSF is not 1 (e.g., letting DummyPageHolder
// update the view size according to the change of DSF).
TEST_P(TextAutosizerTest, ClusterHasEnoughTextToAutosizeForZoomDSF) {}

TEST_P(TextAutosizerTest, AfterPrint) {}

TEST_P(TextAutosizerTest, FingerprintWidth) {}

// Test that `kUsedDeviceScaleAdjustment` is not recorded when a user-specified
// meta viewport is present on the outermost main frame.
TEST_P(TextAutosizerTest, UsedDeviceScaleAdjustmentUseCounterWithViewport) {}

// Test that `kUsedDeviceScaleAdjustment` is recorded when a user-specified meta
// viewport is not specified on the outermost main frame.
TEST_P(TextAutosizerTest, UsedDeviceScaleAdjustmentUseCounterWithoutViewport) {}

class TextAutosizerSimTest : public SimTest,
                             public testing::WithParamInterface<bool>,
                             private ScopedTextSizeAdjustImprovementsForTest {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(TextAutosizerSimTest, CrossSiteUseCounter) {}

TEST_P(TextAutosizerSimTest, ViewportChangesUpdateAutosizing) {}

}  // namespace blink