chromium/ui/views/controls/slider_unittest.cc

// Copyright 2012 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/slider.h"

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

#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/events/event.h"
#include "ui/events/gesture_event_details.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/events/test/event_generator.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/test/ax_event_counter.h"
#include "ui/views/test/slider_test_api.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_delegate.h"
#include "ui/views/widget/widget_utils.h"

namespace {

// A views::SliderListener that tracks simple event call history.
class TestSliderListener : public views::SliderListener {};

void TestSliderListener::SliderValueChanged(views::Slider* sender,
                                            float value,
                                            float old_value,
                                            views::SliderChangeReason reason) {}

void TestSliderListener::SliderDragStarted(views::Slider* sender) {}

void TestSliderListener::SliderDragEnded(views::Slider* sender) {}

}  // namespace

namespace views {

// Base test fixture for Slider tests.
enum class TestSliderType {};

// Parameter specifies whether to test ContinuousSlider (true) or
// DiscreteSlider(false).
class SliderTest : public views::ViewsTestBase,
                   public testing::WithParamInterface<TestSliderType> {};

void SliderTest::ClickAt(int x, int y) {}

void SliderTest::SetUp() {}

void SliderTest::TearDown() {}

float SliderTest::GetMinValue() const {}

float SliderTest::GetMaxValue() const {}

TEST_P(SliderTest, UpdateFromClickHorizontal) {}

TEST_P(SliderTest, UpdateFromClickRTLHorizontal) {}

TEST_P(SliderTest, NukeAllowedValues) {}

TEST_P(SliderTest, AccessibleRole) {}

// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if !BUILDFLAG(IS_MAC) || defined(USE_AURA)

// Test the slider location after a tap gesture.
TEST_P(SliderTest, SliderValueForTapGesture) {}

// Test the slider location after a scroll gesture.
TEST_P(SliderTest, SliderValueForScrollGesture) {}

// Test the slider location by adjusting it using keyboard.
TEST_P(SliderTest, SliderValueForKeyboard) {}

// Verifies the correct SliderListener events are raised for a tap gesture.
TEST_P(SliderTest, SliderListenerEventsForTapGesture) {}

// Verifies the correct SliderListener events are raised for a scroll gesture.
TEST_P(SliderTest, SliderListenerEventsForScrollGesture) {}

// Verifies the correct SliderListener events are raised for a multi
// finger scroll gesture.
TEST_P(SliderTest, SliderListenerEventsForMultiFingerScrollGesture) {}

// Verifies the correct SliderListener events are raised for an accessible
// slider.
TEST_P(SliderTest, SliderRaisesA11yEvents) {}

#endif  // !BUILDFLAG(IS_MAC) || defined(USE_AURA)

INSTANTIATE_TEST_SUITE_P();
}  // namespace views