Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5386 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
5 changed files with 52 additions and 2 deletions
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
using ICSharpCode.AvalonEdit.Document; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.AvalonEdit.Highlighting |
||||
{ |
||||
[TestFixture] |
||||
public class HtmlClipboardTests |
||||
{ |
||||
TextDocument document; |
||||
DocumentHighlighter highlighter; |
||||
|
||||
public HtmlClipboardTests() |
||||
{ |
||||
document = new TextDocument("using System.Text;\n\tstring text = SomeMethod();"); |
||||
highlighter = new DocumentHighlighter(document, HighlightingManager.Instance.GetDefinition("C#").MainRuleSet); |
||||
} |
||||
|
||||
[Test] |
||||
public void FullDocumentTest() |
||||
{ |
||||
var segment = new TextSegment { StartOffset = 0, Length = document.TextLength }; |
||||
string html = HtmlClipboard.CreateHtmlFragment(document, highlighter, segment, new HtmlOptions()); |
||||
Assert.AreEqual("<span style=\"color: #008000; font-weight: bold; \">using</span> " + |
||||
"System<span style=\"color: #006400; \">.</span>Text;<br>" + Environment.NewLine + |
||||
" <span style=\"color: #ff0000; \">string</span> " + |
||||
"text = <span style=\"color: #191970; font-weight: bold; \">SomeMethod</span>();", html); |
||||
} |
||||
|
||||
[Test] |
||||
public void PartOfHighlightedWordTest() |
||||
{ |
||||
var segment = new TextSegment { StartOffset = 1, Length = 3 }; |
||||
string html = HtmlClipboard.CreateHtmlFragment(document, highlighter, segment, new HtmlOptions()); |
||||
Assert.AreEqual("<span style=\"color: #008000; font-weight: bold; \">sin</span>", html); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue