@@ -59,7 +59,7 @@ import org.junit.runner.RunWith
59
59
class DynamicLineToolIntegrationTest {
60
60
61
61
private val colorStringIndex0 = " #FF0074CD"
62
- private val colorStringIndex1 = " #FF00B4F1"
62
+ // private val colorStringIndex1 = "#FF00B4F1"
63
63
private val colorStringIndex2 = " #FF078707"
64
64
private val colorStringBlack = " #FF000000"
65
65
private val colorStringTransparent = " #00000000"
@@ -368,48 +368,6 @@ class DynamicLineToolIntegrationTest {
368
368
TopBarViewInteraction .onTopBarView().performClickCheckmark()
369
369
}
370
370
371
- @Test
372
- fun testColorChangesInConnectedLineMode () {
373
- ToolPropertiesInteraction .onToolProperties().setColor(Color .parseColor(colorStringBlack))
374
-
375
- touchAt(DrawingSurfaceLocationProvider .HALFWAY_LEFT_MIDDLE )
376
- touchAt(DrawingSurfaceLocationProvider .HALFWAY_RIGHT_MIDDLE )
377
-
378
- TopBarViewInteraction .onTopBarView().performClickPlus()
379
-
380
- touchAt(DrawingSurfaceLocationProvider .HALFWAY_BOTTOM_RIGHT )
381
-
382
- TestUtils .selectColorInDialog(0 )
383
- checkPixelColor(colorStringIndex0, BitmapLocationProvider .HALFWAY_BOTTOM_RIGHT )
384
-
385
- TestUtils .selectColorInDialog(1 )
386
- checkPixelColor(colorStringIndex1, BitmapLocationProvider .HALFWAY_BOTTOM_RIGHT )
387
-
388
- TopBarViewInteraction .onTopBarView().performUndo()
389
- checkPixelColor(colorStringIndex0, BitmapLocationProvider .HALFWAY_BOTTOM_RIGHT )
390
-
391
- TopBarViewInteraction .onTopBarView().performRedo()
392
- checkPixelColor(colorStringIndex1, BitmapLocationProvider .HALFWAY_BOTTOM_RIGHT )
393
-
394
- TopBarViewInteraction .onTopBarView().performUndo()
395
- TopBarViewInteraction .onTopBarView().performUndo()
396
- TopBarViewInteraction .onTopBarView().performUndo()
397
-
398
- checkPixelColor(colorStringTransparent, BitmapLocationProvider .HALFWAY_BOTTOM_RIGHT )
399
-
400
- TopBarViewInteraction .onTopBarView().performUndo()
401
- checkPixelColor(colorStringTransparent, BitmapLocationProvider .MIDDLE )
402
-
403
- TopBarViewInteraction .onTopBarView().performRedo()
404
- TopBarViewInteraction .onTopBarView().performRedo()
405
- TopBarViewInteraction .onTopBarView().performRedo()
406
- TopBarViewInteraction .onTopBarView().performRedo()
407
-
408
- checkPixelColor(colorStringIndex0, BitmapLocationProvider .HALFWAY_BOTTOM_RIGHT )
409
-
410
- TopBarViewInteraction .onTopBarView().performClickCheckmark()
411
- }
412
-
413
371
@Test
414
372
fun testColorChangesAndQuittingConnectedLineMode () {
415
373
ToolPropertiesInteraction .onToolProperties().setColor(Color .BLACK )
@@ -457,8 +415,7 @@ class DynamicLineToolIntegrationTest {
457
415
touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_MIDDLE )
458
416
touchAt(DrawingSurfaceLocationProvider .HALFWAY_BOTTOM_MIDDLE )
459
417
touchAt(DrawingSurfaceLocationProvider .BOTTOM_MIDDLE )
460
- touchAt(DrawingSurfaceLocationProvider .BOTTOM_RIGHT_CLOSE_CENTER )
461
-
418
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_RIGHT_MIDDLE )
462
419
463
420
val currentTool = launchActivityRule.activity.defaultToolController.currentTool as DynamicLineTool
464
421
Assert .assertEquals(2 , currentTool.vertexStack.size)
@@ -560,6 +517,105 @@ class DynamicLineToolIntegrationTest {
560
517
checkPixelColor(colorStringBlack, BitmapLocationProvider .HALFWAY_BOTTOM_RIGHT )
561
518
}
562
519
520
+ @Test
521
+ fun testUndoOnlyPathResetsVertexStack () {
522
+ val currentTool = launchActivityRule.activity.defaultToolController.currentTool as DynamicLineTool
523
+ ToolPropertiesInteraction .onToolProperties().setColor(Color .BLACK )
524
+
525
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_LEFT )
526
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_RIGHT )
527
+
528
+ Assert .assertEquals(2 , currentTool.vertexStack.size)
529
+
530
+ TopBarViewInteraction .onTopBarView().performUndo()
531
+
532
+ Assert .assertEquals(0 , currentTool.vertexStack.size)
533
+ }
534
+
535
+ @Test
536
+ fun testUndoOnlyPathRebuildsVertexStackAfterCheckmark () {
537
+ val currentTool = launchActivityRule.activity.defaultToolController.currentTool as DynamicLineTool
538
+ ToolPropertiesInteraction .onToolProperties().setColor(Color .BLACK )
539
+
540
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_LEFT )
541
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_RIGHT )
542
+
543
+ Assert .assertEquals(2 , currentTool.vertexStack.size)
544
+
545
+ TopBarViewInteraction .onTopBarView().performClickCheckmark()
546
+
547
+ Assert .assertEquals(0 , currentTool.vertexStack.size)
548
+
549
+ TopBarViewInteraction .onTopBarView().performUndo()
550
+
551
+ Assert .assertEquals(2 , currentTool.vertexStack.size)
552
+ }
553
+
554
+ @Test
555
+ fun testUndoSecondPathDecreasesVertexStackByOne () {
556
+ val currentTool = launchActivityRule.activity.defaultToolController.currentTool as DynamicLineTool
557
+ ToolPropertiesInteraction .onToolProperties().setColor(Color .BLACK )
558
+
559
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_LEFT )
560
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_RIGHT )
561
+
562
+ Assert .assertEquals(2 , currentTool.vertexStack.size)
563
+
564
+ TopBarViewInteraction .onTopBarView().performClickPlus()
565
+
566
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_BOTTOM_RIGHT )
567
+
568
+ Assert .assertEquals(3 , currentTool.vertexStack.size)
569
+
570
+ TopBarViewInteraction .onTopBarView().performUndo()
571
+
572
+ Assert .assertEquals(2 , currentTool.vertexStack.size)
573
+ }
574
+
575
+ @Test
576
+ fun testUndoAfterTwoPathsRebuildsVertexStackAfterCheckmark () {
577
+ val currentTool = launchActivityRule.activity.defaultToolController.currentTool as DynamicLineTool
578
+ ToolPropertiesInteraction .onToolProperties().setColor(Color .BLACK )
579
+
580
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_LEFT )
581
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_RIGHT )
582
+
583
+ Assert .assertEquals(2 , currentTool.vertexStack.size)
584
+
585
+ TopBarViewInteraction .onTopBarView().performClickPlus()
586
+
587
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_BOTTOM_RIGHT )
588
+
589
+ Assert .assertEquals(3 , currentTool.vertexStack.size)
590
+
591
+ TopBarViewInteraction .onTopBarView().performClickCheckmark()
592
+ TopBarViewInteraction .onTopBarView().performUndo()
593
+
594
+ Assert .assertEquals(3 , currentTool.vertexStack.size)
595
+ }
596
+
597
+ @Test
598
+ fun testTwiceUndoResetsVertexStack () {
599
+ val currentTool = launchActivityRule.activity.defaultToolController.currentTool as DynamicLineTool
600
+ ToolPropertiesInteraction .onToolProperties().setColor(Color .BLACK )
601
+
602
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_LEFT )
603
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_TOP_RIGHT )
604
+
605
+ Assert .assertEquals(2 , currentTool.vertexStack.size)
606
+
607
+ TopBarViewInteraction .onTopBarView().performClickPlus()
608
+
609
+ touchAt(DrawingSurfaceLocationProvider .HALFWAY_BOTTOM_RIGHT )
610
+
611
+ Assert .assertEquals(3 , currentTool.vertexStack.size)
612
+
613
+ TopBarViewInteraction .onTopBarView().performUndo()
614
+ TopBarViewInteraction .onTopBarView().performUndo()
615
+
616
+ Assert .assertEquals(0 , currentTool.vertexStack.size)
617
+ }
618
+
563
619
private fun checkPixelColor (colorString : String , position : BitmapLocationProvider ) {
564
620
DrawingSurfaceInteraction .onDrawingSurfaceView()
565
621
.checkPixelColor(Color .parseColor(colorString), position)
0 commit comments