private static @NotNull Point convertPoint(@NotNull Component from, @NotNull Point point, @NotNull Component to) {
    // Can't just use RelativePoint or SwingUtilities.convertPoint because some tests create just the editor without a root pane.
    var result = new Point(point);
    var fromTopParent = from;
    for (var c = from.getParent(); c != null; c = c.getParent()) {
      fromTopParent = c;
      if (c.getParent() == null) {
        break;
      }
      result.translate(c.getX(), c.getY());
    }
    var toTopParent = to;
    var toOffset = new Point(0, 0);
    for (var c = to.getParent(); c != null; c = c.getParent()) {
      toTopParent = c;
      if (c.getParent() == null) {
        break;
      }
      toOffset.translate(c.getX(), c.getY());
    }
    if (fromTopParent != toTopParent) {
      throw new IllegalArgumentException("Components don't have a common parent: " + from + " and " + to);
    }
    result.translate(-toOffset.x, -toOffset.y);
    return result;
  }
private static @NotNull Point convertPoint(@NotNull Component from, @NotNull Point point, @NotNull Component to)