Project

General

Profile

Actions

action #39335

closed

drag and drop support in testapi

Added by apachelogger over 6 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
Feature requests
Target version:
QA (public, currently private due to #173521) - future
Start date:
2018-08-08
Due date:
% Done:

0%

Estimated time:

Description

It'd be super awesome if the testapi had a function to do drag and drop. This is useful for, well, testing drag and drop. For example in a file manager, or across two applications to check mimetype validation, or to move sliders within an application.

For highest convenience this may actually need additional meaning of needle areas: ideally you'd want to be able to drag and drop from the click area to another area (possibly the second to last in the list of areas?). Additionally, the api should probably allow moving by a pixel delta in any direction.

e.g.

mouse_drag_and_drop(needle=>'foobar', x_offset=>-50)

would assert the needle, mouse down in the click area, move the mouse 50 pixels to the left and release it.

with two areas:

mouse_drag_and_drop(needle=>'foobar')

would match the needle, mose down in the click area, move to the second-to-last area's match and release it.

or without any needles:

mouse_drag_and_drop(x=>500, y=>300, y_offset=>50)

would start the click at the defined coordinates and move down 50 pixels for the release.

For prosperity here's a simple working sample implementation of drag and drop

# cheeky way of getting the click area and calculating the center(
# i.e. click point)
my $needle = assert_screen 'calamares-installer-disk-alongside-adjust';
my $area = $needle->{area}->[-1];
my $x = int($area->{x} + $area->{w} / 2);
my $y = int($area->{y} + $area->{h} / 2);

mouse_set($x, $y);
# mouse down
query_isotovideo('backend_mouse_button', {button => 'left', bstate => 1});
# move to the left
mouse_set($x - 150, $y);
# mouse up
query_isotovideo('backend_mouse_button', {button => 'left', bstate => 0});
# move it away again, lest it screws up needles via hover focus
mouse_hide;
Actions #1

Updated by favogt over 6 years ago

I'd suggest something like

# Move to 'icon' and press left button
mouse_drag('icon');
# Left button stays pressed
...
# Moves to target and lets left button go
mouse_drop('target');

or

# Move to 'icon' and press left button
mouse_drag('icon');
# Left button stays pressed, move 50px to the left
mouse_move(-50, 0);
# Lets left button go and calls mouse_hide
mouse_drop();

instead (or in addition). Working with absolute coordinates directly should be avoided IMO

Actions #2

Updated by okurz over 5 years ago

  • Category set to Feature requests
Actions #3

Updated by okurz over 4 years ago

  • Priority changed from Normal to Low
  • Target version set to future
Actions #4

Updated by okurz over 2 years ago

  • Status changed from New to Resolved
  • Assignee set to okurz
Actions

Also available in: Atom PDF