コード例 #1
0
ファイル: LayoutTests.cs プロジェクト: jugglingcats/XEditNet
        public void WhitespaceHandling1()
        {
            string test="aaaa bbbb  cccc";
            XmlDocument doc=new XmlDocument();
            doc.LoadXml("<doc>"+test+"</doc>");

            Stylesheet s=new Stylesheet();
            s.BindStyles(doc.NameTable);

            //			Rectangle rc=new Rectangle(0, 0, 480, int.MaxValue);
            Rectangle rc=new Rectangle(0, 0, 110, int.MaxValue);

            using ( IGraphics gr=new DummyGraphics() )
            {
                DrawContext ctx=new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine=new LayoutEngine(s);
                layoutEngine.Reflow(ctx, doc.DocumentElement);

                SelectionPoint start=new TextSelectionPoint(doc.DocumentElement.FirstChild, 11);
                Console.WriteLine("Getting caret pos for {0}", start);
                Rectangle c=layoutEngine.GetCaretPosition(gr, start, CaretDirection.None);
                Console.WriteLine("Char {0} at {1}", start.ToString(), c);
            }
        }