Skip to content

Bug/Regression on Mac: pressing mouse on selected text and moving mouse within it unselects selection rather than displacing caret #603

@JordanMartinez

Description

@JordanMartinez

In other words, this test fails on Mac but not on Linux:

public class Test extends InlineCssTextAreaAppTest {

private String firstWord = "Some";
private String firstParagraph = firstWord + " text goes here";
private String extraText = "This is extra text";

@Test
public void pressing_mouse_on_selection_and_dragging_and_releasing_moves_selected_text_to_that_position() {
    // setup
    String twoSpaces = "  ";
    interact(() -> {
        area.replaceText(firstParagraph + "\n" + twoSpaces + extraText);
        area.selectRange(0, firstWord.length());
    });

    String selText = area.getSelectedText();

    Bounds letterInFirstWord = area.getCharacterBoundsOnScreen(1, 2).get();

    int insertionPosition = firstParagraph.length() + 2;
    Bounds insertionBounds = area.getCharacterBoundsOnScreen(insertionPosition, insertionPosition + 1).get();

    moveTo(letterInFirstWord)
            .press(PRIMARY)
            .dropTo(insertionBounds);

    String expectedText = firstParagraph.substring(firstWord.length())
        + "\n" + " " + firstWord + " " + extraText;

    assertEquals(insertionPosition, area.getCaretPosition());

    // Mac build fails here
    assertEquals(selText, area.getSelectedText());

    assertEquals(expectedText, area.getText());
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-MacIssues specific to the Mac platformbugtest

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions