chromium/ui/views/controls/resize_area_unittest.cc

// Copyright 2017 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/resize_area.h"

#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/test/event_generator.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/resize_area_delegate.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_utils.h"

#if !BUILDFLAG(IS_MAC)
#include "ui/aura/window.h"
#endif

namespace {
// Constants used by the ResizeAreaTest.SuccessfulGestureDrag test to simulate
// a gesture drag by |kGestureScrollDistance| resulting from
// |kGestureScrollSteps| ui::EventType::kGestureScrollUpdate events being
// delivered.
const int kGestureScrollDistance =;
const int kGestureScrollSteps =;
const int kDistancePerGestureScrollUpdate =;
}  // namespace

namespace views {

// Testing delegate used by ResizeAreaTest.
class TestResizeAreaDelegate : public ResizeAreaDelegate {};

TestResizeAreaDelegate::TestResizeAreaDelegate() = default;

TestResizeAreaDelegate::~TestResizeAreaDelegate() = default;

void TestResizeAreaDelegate::OnResize(int resize_amount, bool done_resizing) {}

// Test fixture for testing the ResizeArea class.
class ResizeAreaTest : public ViewsTestBase {};

ResizeAreaTest::ResizeAreaTest() = default;

ResizeAreaTest::~ResizeAreaTest() = default;

void ResizeAreaTest::ProcessGesture(ui::EventType type,
                                    const gfx::Vector2dF& delta) {}

void ResizeAreaTest::SetUp() {}

void ResizeAreaTest::TearDown() {}

// TODO(tdanderson): Enable these tests on OSX. See crbug.com/710475.
#if !BUILDFLAG(IS_MAC)
// Verifies the correct calls have been made to
// TestResizeAreaDelegate::OnResize() for a sequence of mouse events
// corresponding to a successful resize operation.
TEST_F(ResizeAreaTest, SuccessfulMouseDrag) {}

// Verifies that no resize is performed when attempting to resize using the
// right mouse button.
TEST_F(ResizeAreaTest, FailedMouseDrag) {}

// Verifies the correct calls have been made to
// TestResizeAreaDelegate::OnResize() for a sequence of gesture events
// corresponding to a successful resize operation.
TEST_F(ResizeAreaTest, SuccessfulGestureDrag) {}

// Verifies that no resize is performed on a gesture tap.
TEST_F(ResizeAreaTest, NoDragOnGestureTap) {}

TEST_F(ResizeAreaTest, AccessibleRole) {}

#endif  // !BUILDFLAG(IS_MAC)

}  // namespace views