[libhandy/wip/exalm/carousel-drag] carousel: Set allow-mouse-drag=false by default



commit acbe24171bb06241b955062d514b3e00dc1acefa
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat May 23 17:40:23 2020 +0500

    carousel: Set allow-mouse-drag=false by default
    
    Update the test.
    
    Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/209
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org>

 src/hdy-carousel.c    |  7 ++-----
 tests/test-carousel.c | 10 +++++-----
 2 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/src/hdy-carousel.c b/src/hdy-carousel.c
index 77804a51..0b841806 100644
--- a/src/hdy-carousel.c
+++ b/src/hdy-carousel.c
@@ -912,15 +912,13 @@ hdy_carousel_class_init (HdyCarouselClass *klass)
    * Sets whether the #HdyCarousel can be dragged with mouse pointer. If the
    * value is %FALSE, dragging is only available on touch.
    *
-   * This should usually be %FALSE.
-   *
    * Since: 1.0
    */
   props[PROP_ALLOW_MOUSE_DRAG] =
     g_param_spec_boolean ("allow-mouse-drag",
                           _("Allow mouse drag"),
                           _("Whether to allow dragging with mouse pointer"),
-                          FALSE,
+                          TRUE,
                           G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
 
   g_object_class_override_property (object_class,
@@ -974,6 +972,7 @@ hdy_carousel_init (HdyCarousel *self)
   self->animation_duration = DEFAULT_DURATION;
 
   self->tracker = hdy_swipe_tracker_new (HDY_SWIPEABLE (self));
+  hdy_swipe_tracker_set_allow_mouse_drag (self->tracker, TRUE);
   self->can_scroll = TRUE;
 
   /*
@@ -1430,8 +1429,6 @@ hdy_carousel_get_allow_mouse_drag (HdyCarousel *self)
  * Sets whether @self can be dragged with mouse pointer. If @allow_mouse_drag
  * is %FALSE, dragging is only available on touch.
  *
- * This should usually be %FALSE.
- *
  * Since: 1.0
  */
 void
diff --git a/tests/test-carousel.c b/tests/test-carousel.c
index 84166821..85fb6d01 100644
--- a/tests/test-carousel.c
+++ b/tests/test-carousel.c
@@ -268,19 +268,19 @@ test_hdy_carousel_allow_mouse_drag (void)
   g_signal_connect (carousel, "notify::allow-mouse-drag", G_CALLBACK (notify_cb), NULL);
 
   /* Accessors */
-  g_assert_false (hdy_carousel_get_allow_mouse_drag (carousel));
-  hdy_carousel_set_allow_mouse_drag (carousel, TRUE);
   g_assert_true (hdy_carousel_get_allow_mouse_drag (carousel));
+  hdy_carousel_set_allow_mouse_drag (carousel, FALSE);
+  g_assert_false (hdy_carousel_get_allow_mouse_drag (carousel));
   g_assert_cmpint (notified, ==, 1);
 
   /* Property */
-  g_object_set (carousel, "allow-mouse-drag", FALSE, NULL);
+  g_object_set (carousel, "allow-mouse-drag", TRUE, NULL);
   g_object_get (carousel, "allow-mouse-drag", &allow_mouse_drag, NULL);
-  g_assert_false (allow_mouse_drag);
+  g_assert_true (allow_mouse_drag);
   g_assert_cmpint (notified, ==, 2);
 
   /* Setting the same value should not notify */
-  hdy_carousel_set_allow_mouse_drag (carousel, FALSE);
+  hdy_carousel_set_allow_mouse_drag (carousel, TRUE);
   g_assert_cmpint (notified, ==, 2);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]