当前位置: 首页>>代码示例>>C#>>正文


C# AssembledStyles类代码示例

本文整理汇总了C#中AssembledStyles的典型用法代码示例。如果您正苦于以下问题:C# AssembledStyles类的具体用法?C# AssembledStyles怎么用?C# AssembledStyles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AssembledStyles类属于命名空间,在下文中一共展示了AssembledStyles类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawIPMultiRunPara

		public void DrawIPMultiRunPara()
		{
			var styles = new AssembledStyles();
			RootBox root = new RootBoxFdo(styles);
			root.Builder.Show(Paragraph.Containing(
				Display.Of("first"), Display.Of("second"), Display.Of("third")));
			SetupFakeRootSite(root);
			var layoutInfo = HookupTests.MakeLayoutInfo(int.MaxValue / 2, m_gm.VwGraphics, 55);
			root.Layout(layoutInfo);
			InsertionPoint ip = root.SelectAtEnd();
			ip.Install();
			var para = (ParaBox) root.FirstBox;
			Assert.AreEqual(ip, root.Selection);
			Assert.AreEqual(para, ip.Para, "IP should know about the paragraph it is in");
			Assert.AreEqual("third".Length, ip.StringPosition, "IP position is relative to run");
			Assert.AreEqual(true, ip.AssociatePrevious, "selection at end should always associate previous in non-empty para");


			StringBox sbox = para.FirstBox as StringBox;
			Assert.That(sbox, Is.EqualTo(para.LastBox), "uniform text in infinite width should make one string box");
			var seg = sbox.Segment as FakeSegment;
			Assert.IsNotNull(seg);
			PaintTransform ptrans = new PaintTransform(2, 4, 96, 100, 0, -10, 120, 128);
			ip.Draw(m_gm.VwGraphics, ptrans);
			VerifySegmentDrawing(para, sbox, seg.LastDrawIpCall, -4);

			seg.NextPosIpResult = new MockSegment.PositionsOfIpResults();
			seg.NextPosIpResult.RectPrimary = new Rect(5, 6, 7, 9);
			seg.NextPosIpResult.PrimaryHere = true;
			Rectangle selRect = ip.GetSelectionLocation(m_gm.VwGraphics, ptrans);
			VerifySelLocation(para, sbox, seg.LastPosIpCall, -4);
			Assert.AreEqual(new Rectangle(5, 6, 2, 3), selRect);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:33,代码来源:InsertionPointTests.cs

示例2: Relayout

		public void Relayout()
		{
			var styles = new AssembledStyles();
			var box = new MockBox(styles);
			var fixMap = new Dictionary<Box, Rectangle>();
			var layoutInfo = ParaBuilderTests.MakeLayoutInfo(100, m_gm.VwGraphics);
			var site = new MockSite();
			var root = new RootBox(styles);
			root.Site = site;

			using (var lcb = new LayoutCallbacks(root))
			{
				Assert.IsFalse(box.Relayout(layoutInfo, fixMap, lcb),
					"Relayout of box never laid out should return false (can't have old loc)");
			}
			Assert.AreEqual(layoutInfo, box.LastLayoutTransform, "Relayout of box never laid out should call Layout() with same transform");
			Assert.AreEqual(0, site.RectsInvalidated.Count, "Relayout of box never laid out should not invalidate anything");

			box.LastLayoutTransform = null;
			using (var lcb = new LayoutCallbacks(root))
				Assert.IsFalse(box.Relayout(layoutInfo, fixMap, lcb), "Relayout of box not in map should return false");
			Assert.IsNull(box.LastLayoutTransform, "Relayout of box not in map should not call Layout()");
			Assert.AreEqual(0, site.RectsInvalidated.Count, "Relayout of box not in map should not invalidate anything");

			fixMap[box] = new Rectangle(2,3,4,7);
			using (var lcb = new LayoutCallbacks(root))
				Assert.IsTrue(box.Relayout(layoutInfo, fixMap, lcb), "Relayout of box in map should return true");
			Assert.AreEqual(layoutInfo, box.LastLayoutTransform, "Relayout of box in map should call Layout() with same transform");
			Assert.AreEqual(1, site.RectsInvalidatedInRoot.Count, "Relayout of box in map should invalidate rect from map");
			Assert.AreEqual(new Rectangle(2, 3, 4, 7), site.RectsInvalidatedInRoot[0], "Relayout of box in map should invalidate proper rect");
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:31,代码来源:BoxTests.cs

示例3: PaintParaBox

		public void PaintParaBox()
		{
			AssembledStyles styles = new AssembledStyles();
			var clientRuns = new List<IClientRun>();
			BlockBox box0 = new BlockBox(styles, Color.Red, 72000, 36000);
			clientRuns.Add(box0);
			BlockBox box1 = new BlockBox(styles, Color.Blue, 36000, 18000);
			clientRuns.Add(box1);
			BlockBox box2 = new BlockBox(styles, Color.Red, 24000, 18000);
			clientRuns.Add(box2);
			BlockBox box3 = new BlockBox(styles, Color.Red, 72000, 36000);
			clientRuns.Add(box3);
			BlockBox box4 = new BlockBox(styles, Color.Red, 36000, 36000);
			clientRuns.Add(box4);

			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);

			PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);
			root.Paint(graphics, ptrans);
			Assert.AreEqual(5, graphics.RectanglesDrawn.Count);
			VerifyRect(2, 2, 96, 48, graphics, 0, Color.Red);
			VerifyRect(2, 48+2, 48, 24, graphics, 1, Color.Blue);
			VerifyRect(2+48, 48 + 2, 32, 24, graphics, 2, Color.Red);
			VerifyRect(2, 24 + 48 + 2, 96, 48, graphics, 3, Color.Red);
			VerifyRect(2, 48 + 24 + 48 + 2, 48, 48, graphics, 4, Color.Red);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:33,代码来源:ParaTests.cs

示例4: Select

		public void Select()
		{
			var styles = new AssembledStyles();
			var root = new RootBoxFdo(styles);
			var mock1 = new MockData1(23, 23);
			mock1.SimpleThree = "new old contents";
			var engine = new FakeRenderEngine() { Ws = 23, SegmentHeight = 13 };
			var factory = new FakeRendererFactory();
			factory.SetRenderer(23, engine);
			root.Builder.Show(Display.Of(() => mock1.SimpleThree, 23));
			var layoutArgs = MakeLayoutInfo(Int32.MaxValue / 2, m_gm.VwGraphics, factory);
			root.Layout(layoutArgs);
			PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);
			MockSite site = new MockSite();
			site.m_transform = ptrans;
			site.m_vwGraphics = m_gm.VwGraphics;
			root.Site = site;

			int x = FakeRenderEngine.SimulatedWidth("new ") + 2;
			var location = new Point(x, 8);
			EventArgs e = new EventArgs();
			MouseEventArgs m = new MouseEventArgs(MouseButtons.Left, 1, location.X, location.Y, 0);

			root.OnMouseDown(m, Keys.None, site.m_vwGraphics, site.m_transform);
			root.OnDoubleClick(e);
			Assert.That(!root.Selection.IsInsertionPoint, "Should be ranged selection");
			Assert.That((root.Selection as RangeSelection).SelectedText(), Is.EqualTo("old "));

			mock1.SimpleThree = "new old:contents";
			x = FakeRenderEngine.SimulatedWidth("new o") + 2;
			location = new Point(x, 8);
			m = new MouseEventArgs(MouseButtons.Left, 1, location.X, location.Y, 0);
			root.OnMouseDown(m, Keys.None, site.m_vwGraphics, site.m_transform);
			root.OnMouseClick(m, Keys.None, site.m_vwGraphics, site.m_transform);
			root.OnDoubleClick(e);
			Assert.That(!root.Selection.IsInsertionPoint, "Should be ranged selection");
			Assert.That((root.Selection as RangeSelection).SelectedText(), Is.EqualTo("old"));

			mock1.SimpleThree = "new(old contents";
			x = FakeRenderEngine.SimulatedWidth("new ol") + 2;
			location = new Point(x, 8);
			m = new MouseEventArgs(MouseButtons.Left, 1, location.X, location.Y, 0);
			root.OnMouseDown(m, Keys.None, site.m_vwGraphics, site.m_transform);
			root.OnMouseClick(m, Keys.None, site.m_vwGraphics, site.m_transform);
			root.OnDoubleClick(e);
			Assert.That(!root.Selection.IsInsertionPoint, "Should be ranged selection");
			Assert.That((root.Selection as RangeSelection).SelectedText(), Is.EqualTo("old "));

			mock1.SimpleThree = "newo1dcontents";
			x = FakeRenderEngine.SimulatedWidth("new o1d") + 2;
			location = new Point(x, 8);
			m = new MouseEventArgs(MouseButtons.Left, 1, location.X, location.Y, 0);
			root.OnMouseDown(m, Keys.None, site.m_vwGraphics, site.m_transform);
			root.OnMouseClick(m, Keys.None, site.m_vwGraphics, site.m_transform);
			root.OnDoubleClick(e);
			Assert.That(!root.Selection.IsInsertionPoint, "Should be ranged selection");
			Assert.That((root.Selection as RangeSelection).SelectedText(), Is.EqualTo("newo1dcontents"));
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:58,代码来源:DoubleClickTests.cs

示例5: StringsInSource

		public void StringsInSource()
		{
			ITsString tss = tsf.MakeString("abc def", wsEn);
			AssembledStyles styles = new AssembledStyles();
			TssClientRun clientRun = new TssClientRun(tss, styles);
			var clientRuns = new List<IClientRun>();
			clientRuns.Add(clientRun);
			TextSource ts = new TextSource(clientRuns);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:9,代码来源:TextSourceTests.cs

示例6: MakeBlockBox

		public void MakeBlockBox()
		{
			AssembledStyles styles = new AssembledStyles();
			BlockBox box = new BlockBox(styles, Color.Red, 72000, 36000);

			LayoutInfo transform = MakeLayoutInfo();
			box.Layout(transform);
			Assert.AreEqual(48, box.Height);
			Assert.AreEqual(96, box.Width);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:10,代码来源:SimpleBoxTests.cs

示例7: BasicDrop

		public void BasicDrop()
		{
			var styles = new AssembledStyles();
			var root = new RootBoxFdo(styles);
			var mock1 = new MockData1(23, 23);
			mock1.SimpleThree = "old contents";
			var engine = new FakeRenderEngine() { Ws = 23, SegmentHeight = 13 };
			var factory = new FakeRendererFactory();
			factory.SetRenderer(23, engine);
			root.Builder.Show(Display.Of(() => mock1.SimpleThree, 23));
			var layoutArgs = MakeLayoutInfo(Int32.MaxValue / 2, m_gm.VwGraphics, factory);
			root.Layout(layoutArgs);
			PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);
			MockSite site = new MockSite();
			site.m_transform = ptrans;
			site.m_vwGraphics = m_gm.VwGraphics;
			root.Site = site;

			var dataObj = new DataObject(DataFormats.StringFormat, "new ");
			int x = FakeRenderEngine.SimulatedWidth("old ") + 2;
			var location = new Point(x, 8);

			// A drag to where we can drop, allowing both copy and move, no keys held
			var dragArgs = new DragEventArgs(dataObj, (int) DragDropKeyStates.None, 200,300,
				DragDropEffects.Copy | DragDropEffects.Move,
				DragDropEffects.None);
			root.OnDragEnter(dragArgs, location, m_gm.VwGraphics, ptrans);
			Assert.That(dragArgs.Effect, Is.EqualTo(DragDropEffects.Move));
			Assert.That(root.DragState, Is.EqualTo(WindowDragState.DraggingHere));
			root.OnDragLeave();
			Assert.That(root.DragState, Is.EqualTo(WindowDragState.None));

			// Though other factors would favor move, only copy is allowed here.
			dragArgs = new DragEventArgs(dataObj, (int)DragDropKeyStates.None, 200,300,
				DragDropEffects.Copy,
				DragDropEffects.None);
			root.OnDragEnter(dragArgs, location, m_gm.VwGraphics, ptrans);
			Assert.That(dragArgs.Effect, Is.EqualTo(DragDropEffects.Copy));

			// Though otherwise we could copy, there is no text data in the data object.
			dragArgs = new DragEventArgs(new DataObject(), (int)DragDropKeyStates.None, 200,300,
				DragDropEffects.Copy | DragDropEffects.Move,
				DragDropEffects.None);
			root.OnDragEnter(dragArgs, location, m_gm.VwGraphics, ptrans);
			Assert.That(dragArgs.Effect, Is.EqualTo(DragDropEffects.None));

			dragArgs = new DragEventArgs(dataObj, (int)DragDropKeyStates.ControlKey, 200,300,
				DragDropEffects.Copy | DragDropEffects.Move,
				DragDropEffects.None);
			root.OnDragEnter(dragArgs, location, m_gm.VwGraphics, ptrans);
			Assert.That(dragArgs.Effect, Is.EqualTo(DragDropEffects.Copy));

			root.OnDragDrop(dragArgs, location, m_gm.VwGraphics, ptrans);
			Assert.That(mock1.SimpleThree, Is.EqualTo("old new contents"));
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:55,代码来源:DragAndDropTests.cs

示例8: DragStartsOnMoveInSelection

		public void DragStartsOnMoveInSelection()
		{
			string contents = "This is the day.";
			var engine = new FakeRenderEngine() {Ws = 34, SegmentHeight = 13};
			var factory = new FakeRendererFactory();
			factory.SetRenderer(34, engine);
			var styles = new AssembledStyles().WithWs(34);
			var clientRuns = new List<IClientRun>();
			var run = new StringClientRun(contents, styles);
			clientRuns.Add(run);
			var source = new TextSource(clientRuns, null);
			var para = new ParaBox(styles, source);
			var extraBox = new BlockBox(styles, Color.Red, 50, 72000); // tall, narrow spacer at top
			var root = new RootBoxFdo(styles);
			root.AddBox(extraBox);
			root.AddBox(para);
			var layoutArgs = MakeLayoutInfo(Int32.MaxValue/2, m_gm.VwGraphics, factory);
			root.Layout(layoutArgs);
			Assert.That(root.Height, Is.EqualTo(96 + 13));
			Assert.That(root.Width, Is.EqualTo(FakeRenderEngine.SimulatedWidth(contents)));

			var ip1 = run.SelectAt(para, 5, false);
			var ip2 = run.SelectAt(para, 7, true);
			var range = new RangeSelection(ip1, ip2);
			range.Install();
			PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);
			var sbox = para.FirstBox as StringBox;
			MockSite site = new MockSite();
			site.m_transform = ptrans;
			site.m_vwGraphics = m_gm.VwGraphics;
			root.Site = site;
			int indent = FakeRenderEngine.SimulatedWidth("This ");
			root.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, indent + 5, 100, 0), Keys.None, m_gm.VwGraphics, ptrans);
			root.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 1, indent + 5, 100, 0), Keys.None, m_gm.VwGraphics, ptrans);
			Assert.That(GetStringDropData(site), Is.EqualTo("is"));
			Assert.That(site.LastDoDragDropArgs.AllowedEffects, Is.EqualTo(DragDropEffects.Copy),
				"editing not possible in this paragraph, we can only copy");
			Assert.That(root.Selection, Is.EqualTo(range), "selection should not be changed by drag drop");
			site.LastDoDragDropArgs = null;
			root.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 3, 100, 0), Keys.None, m_gm.VwGraphics, ptrans);
			Assert.That(site.LastDoDragDropArgs, Is.Null, "click outside selection should not initiate drag");

			// Tack on an extra check that a read-only view does not handle drop.
			var dataObj = new DataObject(DataFormats.StringFormat, "new ");
			var dragArgs = new DragEventArgs(dataObj, (int)DragDropKeyStates.ControlKey, 10, 8,
				DragDropEffects.Copy | DragDropEffects.Move,
				DragDropEffects.None);
			root.OnDragEnter(dragArgs, new Point(14, 8), m_gm.VwGraphics, ptrans);
			Assert.That(dragArgs.Effect, Is.EqualTo(DragDropEffects.None));
			Assert.That(root.DragState, Is.EqualTo(WindowDragState.DraggingHere));
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:51,代码来源:DragAndDropTests.cs

示例9: MakeRootBox

		public void MakeRootBox()
		{
			AssembledStyles styles = new AssembledStyles();
			BlockBox box = new BlockBox(styles, Color.Red, 72000, 36000);

			RootBox root = new RootBox(styles);
			root.AddBox(box);
			LayoutInfo transform = MakeLayoutInfo();
			root.Layout(transform);

			Assert.AreEqual(48, box.Height);
			Assert.AreEqual(96, box.Width);
			Assert.AreEqual(48, root.Height);
			Assert.AreEqual(96, root.Width);

		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:16,代码来源:SimpleBoxTests.cs

示例10: PaintBarBox

		public void PaintBarBox()
		{
			AssembledStyles styles = new AssembledStyles();
			BlockBox box = new BlockBox(styles, Color.Red, 72000, 36000);

			RootBox root = new RootBox(styles);
			root.AddBox(box);
			LayoutInfo transform = MakeLayoutInfo();
			root.Layout(transform);

			PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);
			MockGraphics graphics = new MockGraphics();
			root.Paint(graphics, ptrans);
			Assert.AreEqual(1, graphics.RectanglesDrawn.Count);
			Assert.AreEqual(new Rectangle(2, 2, 96, 48), graphics.RectanglesDrawn[0]);
			Assert.AreEqual((int)ColorUtil.ConvertColorToBGR(Color.Red), graphics.BackColor);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:17,代码来源:SimpleBoxTests.cs

示例11: OneBlockPara

		public void OneBlockPara()
		{
			AssembledStyles styles = new AssembledStyles();
			List<IClientRun> clientRuns = new List<IClientRun>();
			BlockBox box = new BlockBox(styles, Color.Red, 72000, 36000);
			clientRuns.Add(box);

			TextSource source = new TextSource(clientRuns, null);
			ParaBox para = new ParaBox(styles, source);
			RootBox root = new RootBox(styles);
			root.AddBox(para);
			LayoutInfo layoutArgs = MakeLayoutInfo();
			root.Layout(layoutArgs);
			Assert.AreEqual(48, box.Height);
			Assert.AreEqual(96, box.Width);
			Assert.AreEqual(48, root.Height);
			Assert.AreEqual(96, root.Width);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:ParaBuilderTests.cs

示例12: PaintPictureBox

		public void PaintPictureBox()
		{
			AssembledStyles styles = new AssembledStyles();
			Bitmap bm = new Bitmap(20, 30);
			ImageBox box = new ImageBox(styles.WithMargins(new Thickness(72.0 / 96.0 * 2.0))
				.WithBorders(new Thickness(72.0 / 96.0 * 3.0))
				.WithPads(new Thickness(72.0 / 96.0 * 7.0, 72.0 / 96.0 * 8.0, 72.0 / 96.0 * 11.0, 72.0 / 96.0 * 13.0)), bm);

			RootBox root = new RootBox(styles);
			BlockBox block = new BlockBox(styles, Color.Yellow, 2000, 4000);
			root.AddBox(block);
			root.AddBox(box);
			LayoutInfo transform = MakeLayoutInfo();
			root.Layout(transform);
			Assert.That(box.Height, Is.EqualTo(30 + 2*2+3*2+8+13));
			Assert.That(box.Width, Is.EqualTo(20 + 2*2 +3*2 + 7 + 11));
			Assert.That(box.Ascent, Is.EqualTo(box.Height));

			PaintTransform ptrans = new PaintTransform(2, 4, 96, 96, 10, 40, 96, 96);
			MockGraphics graphics = new MockGraphics();
			root.Paint(graphics, ptrans);
			Assert.That(graphics.LastRenderPictureArgs, Is.Not.Null);
			Assert.That(graphics.LastRenderPictureArgs.Picture, Is.EqualTo(box.Picture));
			Assert.That(graphics.LastRenderPictureArgs.X, Is.EqualTo(2-10 + 2 + 3 + 7));
			Assert.That(graphics.LastRenderPictureArgs.Y, Is.EqualTo(4 - 40 + block.Height + 2 + 3 + 8));
			Assert.That(graphics.LastRenderPictureArgs.Cx, Is.EqualTo(20));
			Assert.That(graphics.LastRenderPictureArgs.Cy, Is.EqualTo(30));
			int hmWidth = box.Picture.Width;
			int hmHeight = box.Picture.Height;
			Assert.That(graphics.LastRenderPictureArgs.XSrc, Is.EqualTo(0));
			Assert.That(graphics.LastRenderPictureArgs.YSrc, Is.EqualTo(hmHeight));
			Assert.That(graphics.LastRenderPictureArgs.CxSrc, Is.EqualTo(hmWidth));
			Assert.That(graphics.LastRenderPictureArgs.CySrc, Is.EqualTo(-hmHeight));
			Assert.That(graphics.LastRenderPictureArgs.RcWBounds.left, Is.EqualTo(2 - 10 + 2 + 3 + 7));
			Assert.That(graphics.LastRenderPictureArgs.RcWBounds.top, Is.EqualTo(4 - 40 + block.Height + 2 + 3 + 8));
			Assert.That(graphics.LastRenderPictureArgs.RcWBounds.right, Is.EqualTo(2 - 10 + 2 + 3 + 7 + 20));
			Assert.That(graphics.LastRenderPictureArgs.RcWBounds.bottom, Is.EqualTo(4 - 40 + block.Height + 2 + 3 + 8 + 30));
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:38,代码来源:SimpleBoxTests.cs

示例13: PrepareDivFixupMap

		public void PrepareDivFixupMap()
		{
			var styles = new AssembledStyles();
			var div = new FixedSizeDiv(styles, 27, 37);
			var root = new FixedSizeRoot(styles, 49, 59);
			var block = new BlockBox(styles, Color.Red, 6000, 8000);
			div.AddBox(block);
			root.AddBox(div);
			div.Left = 5;
			div.Top = 7;
			block.Left = 10;
			block.Top = 20;
			var transform = new LayoutInfo(0, 0, 72, 72, 1000, m_gm.VwGraphics, new MockRendererFactory());
			block.Layout(transform);
			//Assert.AreEqual(6, block.Width); // sanity check: we made it 4000 mp wide at 72 dpi, that's 4 points at one point per dot
			var map = block.PrepareFixupMap();
			var invalidRect = map[block];
			Assert.AreEqual(new Rectangle(5 + 10 - 2, 7 + 20 - 2, 6 + 4, 8 + 4), invalidRect);
			invalidRect = map[div];
			Assert.AreEqual(new Rectangle(5 - 2, 7 - 2, 27 + 4, 37 + 4), invalidRect);
			invalidRect = map[root];
			Assert.AreEqual(new Rectangle(- 2, - 2, 49 + 4, 59 + 4), invalidRect);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:23,代码来源:BoxTests.cs

示例14: TssRuns

		public void TssRuns()
		{
			string part1 = "abc def";
			ITsString tss = tsf.MakeString(part1, wsEn);
			AssembledStyles styles = new AssembledStyles();
			TssClientRun clientRun = new TssClientRun(tss, styles);
			Assert.AreEqual(1, clientRun.UniformRunCount);
			Assert.AreEqual(part1, clientRun.UniformRunText(0));
			AssembledStyles style1 = clientRun.UniformRunStyles(0);
			Assert.AreEqual(wsEn, style1.Ws);
			Assert.AreEqual(0, clientRun.UniformRunStart(0));
			Assert.AreEqual(part1.Length, clientRun.UniformRunLength(0));

			string part2 = " ghi";
			ITsStrBldr bldr = tss.GetBldr();
			bldr.Replace(part1.Length, part1.Length, part2, ttpFrn);
			TssClientRun clientRun2 = new TssClientRun(bldr.GetString(), styles);
			Assert.AreEqual(2, clientRun2.UniformRunCount);
			Assert.AreEqual(part1, clientRun2.UniformRunText(0));
			Assert.AreEqual(part2, clientRun2.UniformRunText(1));
			style1 = clientRun2.UniformRunStyles(0);
			Assert.AreEqual(wsEn, style1.Ws);
			AssembledStyles style2 = clientRun2.UniformRunStyles(1);
			Assert.AreEqual(wsFrn, style2.Ws);
			Assert.AreEqual(0, clientRun2.UniformRunStart(0));
			Assert.AreEqual(part1.Length, clientRun2.UniformRunLength(0));
			Assert.AreEqual(part1.Length, clientRun2.UniformRunStart(1));
			Assert.AreEqual(part2.Length, clientRun2.UniformRunLength(1));

			var source = new TextSource(new List<IClientRun>(new [] {clientRun2}));
			var runs = source.Runs;
			Assert.That(runs.Length, Is.EqualTo(2));
			Assert.That(runs[0].LogLength, Is.EqualTo(part1.Length));
			Assert.That(runs[1].LogLength, Is.EqualTo(part2.Length));
			Assert.That(runs[1].LogStart, Is.EqualTo(part1.Length));
			Assert.That(runs[1].Offset, Is.EqualTo(0)); // nothing fancy with ORCs, run starts at 0 in uniform run.
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:37,代码来源:TextSourceTests.cs

示例15: PileOfBlocksLayout

		public void PileOfBlocksLayout()
		{
			var styles = new AssembledStyles();
			BlockBox box1 = new BlockBox(styles, Color.Red, 72000, 36000);
			BlockBox box2 = new BlockBox(styles, Color.Blue, 108000, 18000);
			BlockBox box3 = new BlockBox(styles, Color.Orange, 72000, 18000);
			RootBox root = new RootBox(styles);
			root.AddBox(box1);
			root.AddBox(box2);
			root.AddBox(box3);
			LayoutInfo layoutArgs = MakeLayoutInfo();
			root.Layout(layoutArgs);
			Assert.That(box1.Height, Is.EqualTo(48));
			Assert.That(box2.Height, Is.EqualTo(24));
			Assert.That(root.Height, Is.EqualTo(48 + 24 + 24) );
			Assert.That(box1.Left, Is.EqualTo(0));
			Assert.That(box2.Left, Is.EqualTo(0));
			Assert.That(box1.Top, Is.EqualTo(0));
			Assert.That(box2.Top, Is.EqualTo(48));
			Assert.That(box3.Top, Is.EqualTo(48 + 24));
			Assert.That(box1.Width, Is.EqualTo(96));
			Assert.That(box2.Width, Is.EqualTo(144));
			Assert.That(root.Width, Is.EqualTo(144));
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:24,代码来源:PileTests.cs


注:本文中的AssembledStyles类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。