ClearResults() public method

public ClearResults ( ) : void
return void
Ejemplo n.º 1
0
        public void FlashInsertionPoint()
        {
            AssembledStyles styles     = new AssembledStyles();
            var             clientRuns = new List <IClientRun>();
            BlockBox        box0       = new BlockBox(styles, Color.Red, 72000, 36000);

            clientRuns.Add(box0);
            TextSource source = new TextSource(clientRuns, null);
            ParaBox    para   = new ParaBox(styles, source);
            RootBox    root   = new RootBox(styles);

            root.AddBox(para);
            MockGraphics graphics   = new MockGraphics();
            LayoutInfo   layoutArgs = ParaBuilderTests.MakeLayoutInfo(100, graphics);

            root.Layout(layoutArgs);

            var sel = new DummySelection();

            root.Selection = sel;

            PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);

            root.Paint(graphics, ptrans);

            Assert.AreEqual(graphics, sel.VgUsedToDraw);
            Assert.AreEqual(ptrans, sel.TransformUsedToDraw);

            sel.ClearResults();
            root.FlashInsertionPoint();

            Assert.IsFalse(sel.WasInvalidated, "flash IP should not cause range to be invalidated");

            var ip = new DummySelection();

            ip.SimulateIP  = true;
            root.Selection = ip;
            Assert.IsTrue(ip.WasInvalidated);

            // Initial paint after being installed should indeed paint the IP (so it appears at once)
            ip.ClearResults();
            root.Paint(graphics, ptrans);
            Assert.AreEqual(graphics, ip.VgUsedToDraw);
            Assert.AreEqual(ptrans, ip.TransformUsedToDraw);


            // Each flash should invalide it.
            sel.ClearResults();
            root.FlashInsertionPoint();
            Assert.IsTrue(ip.WasInvalidated);

            // The second paint should do nothing to the IP.
            ip.ClearResults();
            root.Paint(graphics, ptrans);
            Assert.AreEqual(null, ip.VgUsedToDraw);

            // One more flash
            ip.ClearResults();
            root.FlashInsertionPoint();
            Assert.IsTrue(ip.WasInvalidated);

            // And now back to drawing the IP.
            ip.ClearResults();
            root.Paint(graphics, ptrans);
            Assert.AreEqual(graphics, ip.VgUsedToDraw);
            Assert.AreEqual(ptrans, ip.TransformUsedToDraw);

            // range should get drawn even though IP was hidden.
            root.FlashInsertionPoint();       // back to hidden
            root.Selection = sel;             // back to range.
            sel.ClearResults();
            root.Paint(graphics, ptrans);
            Assert.AreEqual(graphics, sel.VgUsedToDraw);
            Assert.AreEqual(ptrans, sel.TransformUsedToDraw);
        }
Ejemplo n.º 2
0
		public void FlashInsertionPoint()
		{
			AssembledStyles styles = new AssembledStyles();
			var clientRuns = new List<IClientRun>();
			BlockBox box0 = new BlockBox(styles, Color.Red, 72000, 36000);
			clientRuns.Add(box0);
			TextSource source = new TextSource(clientRuns, null);
			ParaBox para = new ParaBox(styles, source);
			RootBox root = new RootBox(styles);
			root.AddBox(para);
			MockGraphics graphics = new MockGraphics();
			LayoutInfo layoutArgs = ParaBuilderTests.MakeLayoutInfo(100, graphics);
			root.Layout(layoutArgs);

			var sel = new DummySelection();
			root.Selection = sel;

			PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);
			root.Paint(graphics, ptrans);

			Assert.AreEqual(graphics, sel.VgUsedToDraw);
			Assert.AreEqual(ptrans, sel.TransformUsedToDraw);

			sel.ClearResults();
			root.FlashInsertionPoint();

			Assert.IsFalse(sel.WasInvalidated, "flash IP should not cause range to be invalidated");

			var ip = new DummySelection();
			ip.SimulateIP = true;
			root.Selection = ip;
			Assert.IsTrue(ip.WasInvalidated);

			// Initial paint after being installed should indeed paint the IP (so it appears at once)
			ip.ClearResults();
			root.Paint(graphics, ptrans);
			Assert.AreEqual(graphics, ip.VgUsedToDraw);
			Assert.AreEqual(ptrans, ip.TransformUsedToDraw);


			// Each flash should invalide it.
			sel.ClearResults();
			root.FlashInsertionPoint();
			Assert.IsTrue(ip.WasInvalidated);

			// The second paint should do nothing to the IP.
			ip.ClearResults();
			root.Paint(graphics, ptrans);
			Assert.AreEqual(null, ip.VgUsedToDraw);

			// One more flash
			ip.ClearResults();
			root.FlashInsertionPoint();
			Assert.IsTrue(ip.WasInvalidated);

			// And now back to drawing the IP.
			ip.ClearResults();
			root.Paint(graphics, ptrans);
			Assert.AreEqual(graphics, ip.VgUsedToDraw);
			Assert.AreEqual(ptrans, ip.TransformUsedToDraw);

			// range should get drawn even though IP was hidden.
			root.FlashInsertionPoint(); // back to hidden
			root.Selection = sel; // back to range.
			sel.ClearResults();
			root.Paint(graphics, ptrans);
			Assert.AreEqual(graphics, sel.VgUsedToDraw);
			Assert.AreEqual(ptrans, sel.TransformUsedToDraw);
		}