Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Unified Diff: ui/views/controls/slider_unittest.cc

Issue 2297833002: Fix controlling volume slider with keyboard (Closed)
Patch Set: improve tests Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/slider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/slider_unittest.cc
diff --git a/ui/views/controls/slider_unittest.cc b/ui/views/controls/slider_unittest.cc
index 930665e48ab37f8a5a009481861be5f6141dbc79..cea0a7ad74c1039b53fffbd665f3aaccb1e9558a 100644
--- a/ui/views/controls/slider_unittest.cc
+++ b/ui/views/controls/slider_unittest.cc
@@ -16,6 +16,7 @@
#include "testing/gtest/include/gtest/gtest.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/test/slider_test_api.h"
#include "ui/views/test/views_test_base.h"
@@ -302,6 +303,19 @@ TEST_F(HorizontalSliderTest, SliderValueForScrollGesture) {
EXPECT_NEAR(0.75, slider()->value(), 0.03);
}
+// Test the slider location by adjusting it using keyboard.
+TEST_F(HorizontalSliderTest, SliderValueForKeyboard) {
+ float value =0.5;
+ slider()->SetValue(value);
+ slider()->RequestFocus();
+ event_generator()->PressKey(ui::VKEY_RIGHT, 0);
+ EXPECT_GT(slider()->value(), value);
+
+ slider()->SetValue(value);
+ event_generator()->PressKey(ui::VKEY_LEFT, 0);
+ EXPECT_LT(slider()->value(), value);
+}
+
// Verifies the correct SliderListener events are raised for a tap gesture.
TEST_F(HorizontalSliderTest, SliderListenerEventsForTapGesture) {
test::SliderTestApi slider_test_api(slider());
« no previous file with comments | « ui/views/controls/slider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698