public void CreateTest()
        {
            HtmlFontNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment> val = new HtmlFontNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment>(new FontElementSize(4), new NiconicoTextColor { R = 0xFF, G = 0x00, B = 0x00 }, null);
            var segments = new IReadOnlyNiconicoWebTextSegment[] { new PlainNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment>("fonttest", val) };
            val.Segments = segments;

            IReadOnlyNiconicoWebTextSegment segment = val;

            Assert.IsTrue( segment.DecoratedColor);
            Assert.IsFalse(segment.DecoratedBold);
            Assert.IsFalse(segment.DecoratedItalic);
            Assert.IsFalse(segment.DecoratedStrike);
            Assert.IsFalse(segment.DecoratedUnderLine);
            Assert.IsFalse(segment.HasNumberAnchor);
            Assert.IsTrue(segment.HasSegments);
            Assert.IsFalse(segment.HasUrl);
            Assert.AreEqual(new NiconicoTextColor { R = 0xFF, G = 0x00, B = 0x00 }, segment.Color);
            Assert.AreEqual(new NiconicoWebTextNumberAnchorRange { StartNumber = 0,EndNumber = 0}, segment.NumberAnchor);
            Assert.AreEqual(null, segment.Parent);
            CollectionAssert.AreEqual(segments.ToArray(), segment.Segments.ToArray());
            Assert.AreEqual(null, segment.Url);
            Assert.AreEqual("<font color=\"#FF0000\" size=\"4\">fonttest</font>", segment.Text);
            Assert.AreEqual(NiconicoWebTextSegmentType.HtmlFontElement, segment.SegmentType);
            Assert.AreEqual(4, segment.FontElementSize);
            Assert.AreEqual("fonttest", segment.FriendlyText);
        }
        public void CreateTest()
        {
            HtmlUnderLineNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment> val = new HtmlUnderLineNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment>(null);
            var segmentes = new IReadOnlyNiconicoWebTextSegment[] { new PlainNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment>("testText", val) };
            val.Segments = segmentes;
            IReadOnlyNiconicoWebTextSegment segment = val;

            Assert.IsFalse( segment.DecoratedColor);
            Assert.IsFalse(segment.DecoratedBold);
            Assert.IsFalse(segment.DecoratedItalic);
            Assert.IsFalse(segment.DecoratedStrike);
            Assert.IsTrue(segment.DecoratedUnderLine);
            Assert.IsFalse(segment.HasNumberAnchor);
            Assert.IsTrue(segment.HasSegments);
            Assert.IsFalse(segment.HasUrl);
            Assert.AreEqual(new NiconicoTextColor { R = 0, G = 0, B = 0 }, segment.Color);
            Assert.AreEqual(new NiconicoWebTextNumberAnchorRange { StartNumber = 0,EndNumber = 0}, segment.NumberAnchor);
            Assert.AreEqual(null, segment.Parent);
            CollectionAssert.AreEqual(segmentes.ToArray(), segment.Segments.ToArray());
            Assert.AreEqual(null, segment.Url);
            Assert.AreEqual("<u>testText</u>", segment.Text);
            Assert.AreEqual(NiconicoWebTextSegmentType.HtmlUnderLineElement, segment.SegmentType);
            Assert.AreEqual(3, segment.FontElementSize);
            Assert.AreEqual("testText", segment.FriendlyText);
        }
        public void CreateTest()
        {
            HtmlAnchorNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment> val = new HtmlAnchorNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment>(new Uri("http://www.nicovideo.jp/watch/sm17856110"), null);
            var segments = new IReadOnlyNiconicoWebTextSegment[] { new PlainNiconicoWebTextSegment<IReadOnlyNiconicoWebTextSegment>("htmlanchortest", val) };
            val.Segments = segments;

            IReadOnlyNiconicoWebTextSegment segment = val;

            Assert.IsFalse( segment.DecoratedColor);
            Assert.IsFalse(segment.DecoratedBold);
            Assert.IsFalse(segment.DecoratedItalic);
            Assert.IsFalse(segment.DecoratedStrike);
            Assert.IsFalse(segment.DecoratedUnderLine);
            Assert.IsFalse(segment.HasNumberAnchor);
            Assert.IsTrue(segment.HasSegments);
            Assert.IsTrue(segment.HasUrl);
            Assert.AreEqual(new NiconicoTextColor { R = 0, G = 0, B = 0 }, segment.Color);
            Assert.AreEqual(new NiconicoWebTextNumberAnchorRange { StartNumber = 0,EndNumber = 0}, segment.NumberAnchor);
            Assert.AreEqual(null, segment.Parent);
            CollectionAssert.AreEqual(segments.ToArray(), segment.Segments.ToArray());
            Assert.AreEqual(new Uri("http://www.nicovideo.jp/watch/sm17856110"), segment.Url);
            Assert.AreEqual(@"<a href=""http://www.nicovideo.jp/watch/sm17856110"">htmlanchortest</a>", segment.Text);
            Assert.AreEqual(NiconicoWebTextSegmentType.HtmlAnchorElement, segment.SegmentType);
            Assert.AreEqual(3, segment.FontElementSize);
            Assert.AreEqual("htmlanchortest", segment.FriendlyText);
        }
 internal NiconicoWebTextSegmentClickEventArgs(object text, IReadOnlyNiconicoWebTextSegment segment)
 {
     this.Text = text;
     this.Segment = segment;
 }
Ejemplo n.º 5
0
 public INiconicoWebTextSegment InsertSegmentBefore(IReadOnlyNiconicoWebTextSegment newSemgment, INiconicoWebTextSegment referenceSegment)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 public INiconicoWebTextSegment ImportSegment(IReadOnlyNiconicoWebTextSegment newSegment)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
 private void onSegmentClick(object text, IReadOnlyNiconicoWebTextSegment segment)
 {
     if (this.SegmentClick != null)
     {
         this.SegmentClick(this, new NiconicoWebTextSegmentClickEventArgs(text, segment));
     }
 }