Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | List of all members
FlutterCursorCoordinatorTest Class Reference
Inheritance diagram for FlutterCursorCoordinatorTest:

Instance Methods

(void) - testCoordinatorEventWithinFlutterContent [implementation]
 
(void) - testCoordinatorEventOutsideFlutterContent [implementation]
 

Detailed Description

Definition at line 587 of file FlutterMutatorViewTest.mm.

Method Documentation

◆ testCoordinatorEventOutsideFlutterContent

- (void) testCoordinatorEventOutsideFlutterContent
implementation

Definition at line 40 of file FlutterMutatorViewTest.mm.

643 {
644 id flutterView = OCMClassMock([FlutterView class]);
645 OCMReject([flutterView cursorUpdate:[OCMArg any]]);
646 FlutterCursorCoordinator* coordinator =
647 [[FlutterCursorCoordinator alloc] initWithFlutterView:flutterView];
648 id platformViewWindow = OCMClassMock([NSWindow class]);
649 {
650 id platformView = OCMClassMock([NSView class]);
651 OCMStub([platformViewWindow invalidateCursorRectsForView:platformView]);
652 OCMStub([platformView window]).andReturn(platformViewWindow);
653 OCMStub([flutterView cursorUpdate:[OCMArg any]]);
654 id mutatorView = OCMStrictClassMock([FlutterMutatorView class]);
655 OCMStub([mutatorView platformView]).andReturn(platformView);
656 CGPoint location = NSMakePoint(150, 150);
657 OCMStub([mutatorView convertPoint:location fromView:[OCMArg any]]).andReturn(location);
658 NSEvent* event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
659 location:location
660 modifierFlags:0
661 timestamp:0
662 windowNumber:0
663 context:nil
664 eventNumber:0
665 clickCount:0
666 pressure:0];
667 [coordinator processMouseMoveEvent:event
668 forMutatorView:mutatorView
669 overlayRegion:{CGRectMake(0, 0, 100, 100)}];
670 OCMVerify([platformViewWindow invalidateCursorRectsForView:platformView]);
671 }
672 {
673 // Make sure this is not called again for subsequent invocation during same run loop turn.
674 OCMReject([platformViewWindow invalidateCursorRectsForView:[OCMArg any]]);
675
676 id platformView = OCMClassMock([NSView class]);
677 OCMStub([platformViewWindow invalidateCursorRectsForView:platformView]);
678 OCMStub([platformView window]).andReturn(platformViewWindow);
679 OCMStub([flutterView cursorUpdate:[OCMArg any]]);
680 id mutatorView = OCMStrictClassMock([FlutterMutatorView class]);
681 OCMStub([mutatorView platformView]).andReturn(platformView);
682 CGPoint location = NSMakePoint(150, 150);
683 OCMStub([mutatorView convertPoint:location fromView:[OCMArg any]]).andReturn(location);
684 NSEvent* event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
685 location:location
686 modifierFlags:0
687 timestamp:0
688 windowNumber:0
689 context:nil
690 eventNumber:0
691 clickCount:0
692 pressure:0];
693 [coordinator processMouseMoveEvent:event
694 forMutatorView:mutatorView
695 overlayRegion:{CGRectMake(0, 0, 100, 100)}];
696 }
697 EXPECT_TRUE(coordinator.cleanupScheduled);
698 [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
699 EXPECT_FALSE(coordinator.cleanupScheduled);
700
701 // Check that invalidateCursorRectsForView is called again
702 platformViewWindow = OCMClassMock([NSWindow class]);
703 {
704 id platformView = OCMClassMock([NSView class]);
705 OCMStub([platformViewWindow invalidateCursorRectsForView:platformView]);
706 OCMStub([platformView window]).andReturn(platformViewWindow);
707 OCMStub([flutterView cursorUpdate:[OCMArg any]]);
708 id mutatorView = OCMStrictClassMock([FlutterMutatorView class]);
709 OCMStub([mutatorView platformView]).andReturn(platformView);
710 CGPoint location = NSMakePoint(150, 150);
711 OCMStub([mutatorView convertPoint:location fromView:[OCMArg any]]).andReturn(location);
712 NSEvent* event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
713 location:location
714 modifierFlags:0
715 timestamp:0
716 windowNumber:0
717 context:nil
718 eventNumber:0
719 clickCount:0
720 pressure:0];
721 [coordinator processMouseMoveEvent:event
722 forMutatorView:mutatorView
723 overlayRegion:{CGRectMake(0, 0, 100, 100)}];
724 OCMVerify([platformViewWindow invalidateCursorRectsForView:platformView]);
725 }
726 [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
727}
GLFWwindow * window
Definition main.cc:45
void processMouseMoveEvent:forMutatorView:overlayRegion:(NSEvent *event, [forMutatorView] FlutterMutatorView *view, [overlayRegion] const std::vector< CGRect > &region)
SIT bool any(const Vec< 1, T > &x)
Definition SkVx.h:530
#define EXPECT_TRUE(handle)
Definition unit_test.h:685

◆ testCoordinatorEventWithinFlutterContent

- (void) testCoordinatorEventWithinFlutterContent
implementation

Definition at line 40 of file FlutterMutatorViewTest.mm.

592 {
593 id flutterView = OCMClassMock([FlutterView class]);
594 FlutterCursorCoordinator* coordinator =
595 [[FlutterCursorCoordinator alloc] initWithFlutterView:flutterView];
596 {
597 id platformView = OCMClassMock([NSView class]);
598 OCMStub([flutterView cursorUpdate:[OCMArg any]]);
599 id mutatorView = OCMStrictClassMock([FlutterMutatorView class]);
600 OCMStub([mutatorView platformView]).andReturn(platformView);
601 CGPoint location = NSMakePoint(50, 50);
602 OCMStub([mutatorView convertPoint:location fromView:[OCMArg any]]).andReturn(location);
603 NSEvent* event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
604 location:location
605 modifierFlags:0
606 timestamp:0
607 windowNumber:0
608 context:nil
609 eventNumber:0
610 clickCount:0
611 pressure:0];
612 [coordinator processMouseMoveEvent:event
613 forMutatorView:mutatorView
614 overlayRegion:{CGRectMake(0, 0, 100, 100)}];
615 OCMVerify([flutterView cursorUpdate:event]);
616 }
617 {
618 id platformView = OCMClassMock([NSView class]);
619 // Make sure once event is handled the coordinator will not send cursorUpdate again.
620 OCMReject([flutterView cursorUpdate:[OCMArg any]]);
621 id mutatorView = OCMStrictClassMock([FlutterMutatorView class]);
622 OCMStub([mutatorView platformView]).andReturn(platformView);
623 CGPoint location = NSMakePoint(50, 50);
624 OCMStub([mutatorView convertPoint:location fromView:[OCMArg any]]).andReturn(location);
625 NSEvent* event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
626 location:location
627 modifierFlags:0
628 timestamp:0
629 windowNumber:0
630 context:nil
631 eventNumber:0
632 clickCount:0
633 pressure:0];
634 [coordinator processMouseMoveEvent:event
635 forMutatorView:mutatorView
636 overlayRegion:{CGRectMake(0, 0, 100, 100)}];
637 }
638 EXPECT_TRUE(coordinator.cleanupScheduled);
639 [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
640 EXPECT_FALSE(coordinator.cleanupScheduled);
641}
FlKeyEvent * event

The documentation for this class was generated from the following file: