@@ -28,6 +28,7 @@ defmodule Scenic.ViewPort.InputTest do
28
28
29
29
setup do
30
30
{ :ok , tables } = Tables . start_link ( nil )
31
+
31
32
on_exit ( fn ->
32
33
Process . exit ( tables , :normal )
33
34
Process . sleep ( 2 )
@@ -64,12 +65,13 @@ defmodule Scenic.ViewPort.InputTest do
64
65
Process . sleep ( 10 )
65
66
66
67
# build a capture context for the nested graph
67
- tx = Matrix . build_translation ( { 1 , 1 } )
68
+ tx = Matrix . build_translation ( { 1 , 1 } )
68
69
inv = Matrix . invert ( tx )
70
+
69
71
context = % Context {
70
72
graph_key: graph_key1 ,
71
73
tx: tx ,
72
- inverse_tx: inv ,
74
+ inverse_tx: inv
73
75
}
74
76
75
77
% {
@@ -491,9 +493,12 @@ defmodule Scenic.ViewPort.InputTest do
491
493
assert context . uid == nil
492
494
end
493
495
494
- test "captured cursor_button" , % { graph_key: graph_key ,
496
+ test "captured cursor_button" , % {
497
+ graph_key: graph_key ,
495
498
graph_key1: graph_key1 ,
496
- context: context , master_graph_key: master_graph_key } do
499
+ context: context ,
500
+ master_graph_key: master_graph_key
501
+ } do
497
502
# start NOT over a primitive
498
503
{ :noreply , _ } =
499
504
Input . handle_cast (
@@ -505,9 +510,11 @@ defmodule Scenic.ViewPort.InputTest do
505
510
max_depth: 10
506
511
}
507
512
)
513
+
508
514
assert_received (
509
515
{ :"$gen_cast" , { :input , { :cursor_button , { :left , :press , 0 , { 0.0 , 0.0 } } } , context } }
510
516
)
517
+
511
518
assert context . graph_key == graph_key1
512
519
assert context . id == nil
513
520
assert context . uid == nil
@@ -527,14 +534,18 @@ defmodule Scenic.ViewPort.InputTest do
527
534
assert_received (
528
535
{ :"$gen_cast" , { :input , { :cursor_button , { :left , :press , 0 , { 49.0 , 49.0 } } } , context } }
529
536
)
537
+
530
538
assert context . graph_key == graph_key1
531
539
assert context . id == :circle
532
540
assert context . uid == 1
533
541
end
534
542
535
- test "captured cursor_scroll" , % { graph_key: graph_key ,
543
+ test "captured cursor_scroll" , % {
544
+ graph_key: graph_key ,
536
545
graph_key1: graph_key1 ,
537
- context: context , master_graph_key: master_graph_key } do
546
+ context: context ,
547
+ master_graph_key: master_graph_key
548
+ } do
538
549
# start NOT over a primitive
539
550
{ :noreply , _ } =
540
551
Input . handle_cast (
@@ -570,9 +581,11 @@ defmodule Scenic.ViewPort.InputTest do
570
581
assert context . uid == 1
571
582
end
572
583
573
- test "captured viewport_enter" , % { graph_key: graph_key ,
584
+ test "captured viewport_enter" , % {
585
+ graph_key: graph_key ,
574
586
graph_key1: graph_key1 ,
575
- context: context } do
587
+ context: context
588
+ } do
576
589
# start NOT over a primitive
577
590
{ :noreply , _ } =
578
591
Input . handle_cast (
@@ -587,9 +600,7 @@ defmodule Scenic.ViewPort.InputTest do
587
600
assert context . graph_key == graph_key1
588
601
end
589
602
590
- test "captured viewport_exit" , % { graph_key: graph_key ,
591
- graph_key1: graph_key1 ,
592
- context: context } do
603
+ test "captured viewport_exit" , % { graph_key: graph_key , graph_key1: graph_key1 , context: context } do
593
604
# start NOT over a primitive
594
605
{ :noreply , _ } =
595
606
Input . handle_cast (
@@ -604,9 +615,7 @@ defmodule Scenic.ViewPort.InputTest do
604
615
assert context . graph_key == graph_key1
605
616
end
606
617
607
- test "captured other" , % { graph_key: graph_key ,
608
- graph_key1: graph_key1 ,
609
- context: context } do
618
+ test "captured other" , % { graph_key: graph_key , graph_key1: graph_key1 , context: context } do
610
619
# start NOT over a primitive
611
620
{ :noreply , _ } =
612
621
Input . handle_cast (
@@ -640,9 +649,7 @@ defmodule Scenic.ViewPort.InputTest do
640
649
}
641
650
)
642
651
643
- assert_received (
644
- { :"$gen_cast" , { :input , { :cursor_pos , { 0.0 , 0.0 } } , context } }
645
- )
652
+ assert_received ( { :"$gen_cast" , { :input , { :cursor_pos , { 0.0 , 0.0 } } , context } } )
646
653
assert context . graph_key == graph_key1
647
654
assert context . id == nil
648
655
assert context . uid == nil
@@ -667,9 +674,7 @@ defmodule Scenic.ViewPort.InputTest do
667
674
}
668
675
)
669
676
670
- assert_received (
671
- { :"$gen_cast" , { :input , { :cursor_pos , { 24.0 , 24.0 } } , context } }
672
- )
677
+ assert_received ( { :"$gen_cast" , { :input , { :cursor_pos , { 24.0 , 24.0 } } , context } } )
673
678
assert context . graph_key == graph_key1
674
679
assert context . id == nil
675
680
assert context . uid == nil
@@ -694,9 +699,7 @@ defmodule Scenic.ViewPort.InputTest do
694
699
}
695
700
)
696
701
697
- assert_received (
698
- { :"$gen_cast" , { :input , { :cursor_pos , { 49.0 , 49.0 } } , context } }
699
- )
702
+ assert_received ( { :"$gen_cast" , { :input , { :cursor_pos , { 49.0 , 49.0 } } , context } } )
700
703
refute_received ( { :"$gen_cast" , { :input , { :cursor_exit , _ } , _ } } )
701
704
assert_received ( { :"$gen_cast" , { :input , { :cursor_enter , 1 } , _ } } )
702
705
@@ -724,9 +727,7 @@ defmodule Scenic.ViewPort.InputTest do
724
727
}
725
728
)
726
729
727
- assert_received (
728
- { :"$gen_cast" , { :input , { :cursor_pos , { 1.0 , 1.0 } } , context } }
729
- )
730
+ assert_received ( { :"$gen_cast" , { :input , { :cursor_pos , { 1.0 , 1.0 } } , context } } )
730
731
assert_received ( { :"$gen_cast" , { :input , { :cursor_exit , 1 } , _ } } )
731
732
refute_received ( { :"$gen_cast" , { :input , { :cursor_enter , _ } , _ } } )
732
733
end
0 commit comments