467
466
self.assertThat(grip.opacity, Eventually(Equals(1.0)))
469
468
# Test that an item bounces back when dragged within the list itself
470
self.pointing_device.drag(original_x, original_y,
471
original_x, original_y + 200)
469
self.pointing_device.drag(rect.x, rect.y,
470
rect.x, rect.y + 200)
471
self.assertThat(grip.globalRect, Eventually(Equals(rect)))
473
473
# Test that an item bounces back when dragged to the same folder
474
474
folder = folders[0]
475
475
folder_cx = folder.globalRect.x + folder.width / 2
476
476
folder_cy = folder.globalRect.y + folder.height / 2
477
self.pointing_device.drag(original_x, original_y,
478
folder_cx, folder_cy)
480
self.assertThat(lambda: (grip.globalRect.x, grip.globalRect.y),
481
Eventually(Equals((original_x, original_y))))
477
# Work around https://launchpad.net/bugs/1499437 by dragging downwards
478
# a little bit first, then to the target folder.
479
self.pointing_device.move_to_object(grip)
480
pos = self.pointing_device.position()
481
self.pointing_device.press()
482
self.pointing_device.move(pos[0], pos[1] + 20)
483
self.pointing_device.move(folder_cx, folder_cy)
484
self.pointing_device.release()
485
self.assertThat(grip.globalRect, Eventually(Equals(rect)))
483
487
# Test that dragging an item to another folder removes it from this one
484
488
# and adds it to the target folder
485
489
folder = folders[2]
486
490
folder_cx = folder.globalRect.x + folder.width / 2
487
491
folder_cy = folder.globalRect.y + folder.height / 2
488
self.pointing_device.drag(original_x, original_y,
489
folder_cx, folder_cy)
492
# Work around https://launchpad.net/bugs/1499437 by dragging downwards
493
# a little bit first, then to the target folder.
494
self.pointing_device.move_to_object(grip)
495
pos = self.pointing_device.position()
496
self.pointing_device.press()
497
self.pointing_device.move(pos[0], pos[1] + 20)
498
# Move the cursor to a few pixels below the vertical center of the
499
# folder to ensure that the folder above doesn’t get targetted instead.
500
self.pointing_device.move(folder_cx, folder_cy + 5)
501
self.pointing_device.release()
491
502
self.assertThat(lambda: len(view.get_bookmarks_list()),
492
503
Eventually(NotEquals(previous_count)))