1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/richtextctrltest.cpp
3 // Purpose: wxRichTextCtrl unit test
4 // Author: Steven Lamerton
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
22 #include "wx/richtext/richtextctrl.h"
23 #include "wx/richtext/richtextstyles.h"
24 #include "testableframe.h"
25 #include "asserthelper.h"
26 #include "wx/uiaction.h"
28 class RichTextCtrlTestCase
: public CppUnit::TestCase
31 RichTextCtrlTestCase() { }
37 CPPUNIT_TEST_SUITE( RichTextCtrlTestCase
);
38 WXUISIM_TEST( CharacterEvent
);
39 WXUISIM_TEST( DeleteEvent
);
40 WXUISIM_TEST( ReturnEvent
);
41 CPPUNIT_TEST( StyleEvent
);
42 CPPUNIT_TEST( BufferResetEvent
);
43 WXUISIM_TEST( UrlEvent
);
44 WXUISIM_TEST( TextEvent
);
45 CPPUNIT_TEST( CutCopyPaste
);
46 CPPUNIT_TEST( UndoRedo
);
47 CPPUNIT_TEST( CaretPosition
);
48 CPPUNIT_TEST( Selection
);
49 WXUISIM_TEST( Editable
);
50 CPPUNIT_TEST( Range
);
51 CPPUNIT_TEST( Alignment
);
53 CPPUNIT_TEST( Italic
);
54 CPPUNIT_TEST( Underline
);
55 CPPUNIT_TEST( Indent
);
56 CPPUNIT_TEST( LineSpacing
);
57 CPPUNIT_TEST( ParagraphSpacing
);
58 CPPUNIT_TEST( TextColour
);
59 CPPUNIT_TEST( NumberedBullet
);
60 CPPUNIT_TEST( SymbolBullet
);
61 CPPUNIT_TEST( FontSize
);
63 CPPUNIT_TEST( Delete
);
65 CPPUNIT_TEST_SUITE_END();
67 void CharacterEvent();
71 void BufferResetEvent();
86 void ParagraphSpacing();
88 void NumberedBullet();
95 wxRichTextCtrl
* m_rich
;
97 DECLARE_NO_COPY_CLASS(RichTextCtrlTestCase
)
100 // register in the unnamed registry so that these tests are run by default
101 CPPUNIT_TEST_SUITE_REGISTRATION( RichTextCtrlTestCase
);
103 // also include in its own registry so that these tests can be run alone
104 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( RichTextCtrlTestCase
, "RichTextCtrlTestCase" );
106 void RichTextCtrlTestCase::setUp()
108 m_rich
= new wxRichTextCtrl(wxTheApp
->GetTopWindow(), wxID_ANY
, "",
109 wxDefaultPosition
, wxSize(400, 200));
112 void RichTextCtrlTestCase::tearDown()
117 void RichTextCtrlTestCase::CharacterEvent()
119 #if wxUSE_UIACTIONSIMULATOR
121 // There seems to be an event sequence problem on GTK+ that causes the events
122 // to be disconnected before they're processed, generating spurious errors.
123 #if !defined(__WXGTK__)
124 wxTestableFrame
* frame
= wxStaticCast(wxTheApp
->GetTopWindow(),
127 EventCounter
count(m_rich
, wxEVT_COMMAND_RICHTEXT_CHARACTER
);
128 EventCounter
count1(m_rich
, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED
);
132 wxUIActionSimulator sim
;
136 CPPUNIT_ASSERT_EQUAL(6, frame
->GetEventCount(wxEVT_COMMAND_RICHTEXT_CHARACTER
));
137 CPPUNIT_ASSERT_EQUAL(6, frame
->GetEventCount(wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED
));
139 //As these are not characters they shouldn't count
140 sim
.Char(WXK_RETURN
);
144 CPPUNIT_ASSERT_EQUAL(0, frame
->GetEventCount(wxEVT_COMMAND_RICHTEXT_CHARACTER
));
145 CPPUNIT_ASSERT_EQUAL(1, frame
->GetEventCount(wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED
));
150 void RichTextCtrlTestCase::DeleteEvent()
152 #if wxUSE_UIACTIONSIMULATOR
153 // There seems to be an event sequence problem on GTK+ that causes the events
154 // to be disconnected before they're processed, generating spurious errors.
155 #if !defined(__WXGTK__)
156 wxTestableFrame
* frame
= wxStaticCast(wxTheApp
->GetTopWindow(),
159 EventCounter
count(m_rich
, wxEVT_COMMAND_RICHTEXT_DELETE
);
160 EventCounter
count1(m_rich
, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED
);
164 wxUIActionSimulator sim
;
167 sim
.Char(WXK_DELETE
);
170 CPPUNIT_ASSERT_EQUAL(2, frame
->GetEventCount(wxEVT_COMMAND_RICHTEXT_DELETE
));
171 //Only one as the delete doesn't delete anthing
172 CPPUNIT_ASSERT_EQUAL(1, frame
->GetEventCount(wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED
));
177 void RichTextCtrlTestCase::ReturnEvent()
179 #if wxUSE_UIACTIONSIMULATOR
180 // There seems to be an event sequence problem on GTK+ that causes the events
181 // to be disconnected before they're processed, generating spurious errors.
182 #if !defined(__WXGTK__)
183 wxTestableFrame
* frame
= wxStaticCast(wxTheApp
->GetTopWindow(),
186 EventCounter
count(m_rich
, wxEVT_COMMAND_RICHTEXT_RETURN
);
190 wxUIActionSimulator sim
;
191 sim
.Char(WXK_RETURN
);
194 CPPUNIT_ASSERT_EQUAL(1, frame
->GetEventCount());
199 void RichTextCtrlTestCase::StyleEvent()
201 wxTestableFrame
* frame
= wxStaticCast(wxTheApp
->GetTopWindow(),
204 EventCounter
count(m_rich
, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED
);
206 m_rich
->SetValue("Sometext");
207 m_rich
->SetStyle(0, 8, wxTextAttr(*wxRED
, *wxWHITE
));
209 CPPUNIT_ASSERT_EQUAL(1, frame
->GetEventCount(wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED
));
212 void RichTextCtrlTestCase::BufferResetEvent()
214 wxTestableFrame
* frame
= wxStaticCast(wxTheApp
->GetTopWindow(),
217 EventCounter
count(m_rich
, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET
);
219 m_rich
->AppendText("more text!");
220 m_rich
->SetValue("");
222 CPPUNIT_ASSERT_EQUAL(1, frame
->GetEventCount());
224 m_rich
->AppendText("more text!");
227 CPPUNIT_ASSERT_EQUAL(1, frame
->GetEventCount());
229 //We expect a buffer reset here as setvalue clears the existing text
230 m_rich
->SetValue("replace");
231 CPPUNIT_ASSERT_EQUAL(1, frame
->GetEventCount());
234 void RichTextCtrlTestCase::UrlEvent()
236 #if wxUSE_UIACTIONSIMULATOR
237 // Mouse up event not being caught on GTK+
238 #if !defined(__WXGTK__)
239 wxTestableFrame
* frame
= wxStaticCast(wxTheApp
->GetTopWindow(),
242 EventCounter
count(m_rich
, wxEVT_COMMAND_TEXT_URL
);
244 m_rich
->BeginURL("http://www.wxwidgets.org");
245 m_rich
->WriteText("http://www.wxwidgets.org");
248 wxUIActionSimulator sim
;
249 sim
.MouseMove(m_rich
->ClientToScreen(wxPoint(10, 10)));
255 CPPUNIT_ASSERT_EQUAL(1, frame
->GetEventCount());
260 void RichTextCtrlTestCase::TextEvent()
262 #if wxUSE_UIACTIONSIMULATOR
263 #if !defined(__WXGTK__)
264 wxTestableFrame
* frame
= wxStaticCast(wxTheApp
->GetTopWindow(),
267 EventCounter
count(m_rich
, wxEVT_COMMAND_TEXT_UPDATED
);
271 wxUIActionSimulator sim
;
275 CPPUNIT_ASSERT_EQUAL("abcdef", m_rich
->GetValue());
276 CPPUNIT_ASSERT_EQUAL(6, frame
->GetEventCount());
281 void RichTextCtrlTestCase::CutCopyPaste()
284 m_rich
->AppendText("sometext");
287 if(m_rich
->CanCut() && m_rich
->CanPaste())
290 CPPUNIT_ASSERT(m_rich
->IsEmpty());
295 CPPUNIT_ASSERT_EQUAL("sometext", m_rich
->GetValue());
300 if(m_rich
->CanCopy() && m_rich
->CanPaste())
304 CPPUNIT_ASSERT(m_rich
->IsEmpty());
309 CPPUNIT_ASSERT_EQUAL("sometext", m_rich
->GetValue());
314 void RichTextCtrlTestCase::UndoRedo()
316 m_rich
->AppendText("sometext");
318 CPPUNIT_ASSERT(m_rich
->CanUndo());
322 CPPUNIT_ASSERT(m_rich
->IsEmpty());
323 CPPUNIT_ASSERT(m_rich
->CanRedo());
327 CPPUNIT_ASSERT_EQUAL("sometext", m_rich
->GetValue());
329 m_rich
->AppendText("Batch undo");
332 //Also test batch operations
333 m_rich
->BeginBatchUndo("batchtest");
335 m_rich
->ApplyBoldToSelection();
336 m_rich
->ApplyItalicToSelection();
338 m_rich
->EndBatchUndo();
340 CPPUNIT_ASSERT(m_rich
->CanUndo());
344 CPPUNIT_ASSERT(!m_rich
->IsSelectionBold());
345 CPPUNIT_ASSERT(!m_rich
->IsSelectionItalics());
346 CPPUNIT_ASSERT(m_rich
->CanRedo());
350 CPPUNIT_ASSERT(m_rich
->IsSelectionBold());
351 CPPUNIT_ASSERT(m_rich
->IsSelectionItalics());
353 //And surpressing undo
354 m_rich
->BeginSuppressUndo();
356 m_rich
->AppendText("Can't undo this");
358 CPPUNIT_ASSERT(m_rich
->CanUndo());
360 m_rich
->EndSuppressUndo();
363 void RichTextCtrlTestCase::CaretPosition()
365 m_rich
->AddParagraph("This is paragraph one");
366 m_rich
->AddParagraph("Paragraph two\n has \nlots of\n lines");
368 m_rich
->MoveCaret(1);
370 CPPUNIT_ASSERT_EQUAL(1, m_rich
->GetCaretPosition());
372 m_rich
->MoveToParagraphStart();
374 CPPUNIT_ASSERT_EQUAL(0, m_rich
->GetCaretPosition());
377 m_rich
->MoveRight(2);
381 CPPUNIT_ASSERT_EQUAL(2, m_rich
->GetCaretPosition());
383 m_rich
->MoveToParagraphEnd();
385 CPPUNIT_ASSERT_EQUAL(21, m_rich
->GetCaretPosition());
387 m_rich
->MoveToLineStart();
389 CPPUNIT_ASSERT_EQUAL(0, m_rich
->GetCaretPosition());
391 m_rich
->MoveToLineEnd();
393 CPPUNIT_ASSERT_EQUAL(21, m_rich
->GetCaretPosition());
396 void RichTextCtrlTestCase::Selection()
398 m_rich
->SetValue("some more text");
402 CPPUNIT_ASSERT_EQUAL("some more text", m_rich
->GetStringSelection());
404 m_rich
->SelectNone();
406 CPPUNIT_ASSERT_EQUAL("", m_rich
->GetStringSelection());
408 m_rich
->SelectWord(1);
410 CPPUNIT_ASSERT_EQUAL("some", m_rich
->GetStringSelection());
412 m_rich
->SetSelection(5, 14);
414 CPPUNIT_ASSERT_EQUAL("more text", m_rich
->GetStringSelection());
416 wxRichTextRange
range(5, 9);
418 m_rich
->SetSelectionRange(range
);
420 CPPUNIT_ASSERT_EQUAL("more", m_rich
->GetStringSelection());
423 void RichTextCtrlTestCase::Editable()
425 #if wxUSE_UIACTIONSIMULATOR
426 #if !defined(__WXGTK__)
427 wxTestableFrame
* frame
= wxStaticCast(wxTheApp
->GetTopWindow(),
430 EventCounter
count(m_rich
, wxEVT_COMMAND_TEXT_UPDATED
);
434 wxUIActionSimulator sim
;
438 CPPUNIT_ASSERT_EQUAL("abcdef", m_rich
->GetValue());
439 CPPUNIT_ASSERT_EQUAL(6, frame
->GetEventCount());
441 m_rich
->SetEditable(false);
445 CPPUNIT_ASSERT_EQUAL("abcdef", m_rich
->GetValue());
446 CPPUNIT_ASSERT_EQUAL(0, frame
->GetEventCount());
451 void RichTextCtrlTestCase::Range()
453 wxRichTextRange
range(0, 10);
455 CPPUNIT_ASSERT_EQUAL(0, range
.GetStart());
456 CPPUNIT_ASSERT_EQUAL(10, range
.GetEnd());
457 CPPUNIT_ASSERT_EQUAL(11, range
.GetLength());
458 CPPUNIT_ASSERT(range
.Contains(5));
460 wxRichTextRange
outside(12, 14);
462 CPPUNIT_ASSERT(outside
.IsOutside(range
));
464 wxRichTextRange
inside(6, 7);
466 CPPUNIT_ASSERT(inside
.IsWithin(range
));
468 range
.LimitTo(inside
);
470 CPPUNIT_ASSERT(inside
== range
);
471 CPPUNIT_ASSERT(inside
+ range
== outside
);
472 CPPUNIT_ASSERT(outside
- range
== inside
);
477 CPPUNIT_ASSERT_EQUAL(4, range
.GetStart());
478 CPPUNIT_ASSERT_EQUAL(6, range
.GetEnd());
479 CPPUNIT_ASSERT_EQUAL(3, range
.GetLength());
481 inside
.SetRange(6, 4);
484 CPPUNIT_ASSERT(inside
== range
);
487 void RichTextCtrlTestCase::Alignment()
489 m_rich
->SetValue("text to align");
492 m_rich
->ApplyAlignmentToSelection(wxTEXT_ALIGNMENT_RIGHT
);
494 CPPUNIT_ASSERT(m_rich
->IsSelectionAligned(wxTEXT_ALIGNMENT_RIGHT
));
496 m_rich
->BeginAlignment(wxTEXT_ALIGNMENT_CENTRE
);
497 m_rich
->AddParagraph("middle aligned");
498 m_rich
->EndAlignment();
500 m_rich
->SetSelection(20, 25);
502 CPPUNIT_ASSERT(m_rich
->IsSelectionAligned(wxTEXT_ALIGNMENT_CENTRE
));
505 void RichTextCtrlTestCase::Bold()
507 m_rich
->SetValue("text to bold");
509 m_rich
->ApplyBoldToSelection();
511 CPPUNIT_ASSERT(m_rich
->IsSelectionBold());
514 m_rich
->AddParagraph("bold paragraph");
516 m_rich
->AddParagraph("not bold paragraph");
518 m_rich
->SetSelection(15, 20);
520 CPPUNIT_ASSERT(m_rich
->IsSelectionBold());
522 m_rich
->SetSelection(30, 35);
524 CPPUNIT_ASSERT(!m_rich
->IsSelectionBold());
527 void RichTextCtrlTestCase::Italic()
529 m_rich
->SetValue("text to italic");
531 m_rich
->ApplyItalicToSelection();
533 CPPUNIT_ASSERT(m_rich
->IsSelectionItalics());
535 m_rich
->BeginItalic();
536 m_rich
->AddParagraph("italic paragraph");
538 m_rich
->AddParagraph("not italic paragraph");
540 m_rich
->SetSelection(20, 25);
542 CPPUNIT_ASSERT(m_rich
->IsSelectionItalics());
544 m_rich
->SetSelection(35, 40);
546 CPPUNIT_ASSERT(!m_rich
->IsSelectionItalics());
549 void RichTextCtrlTestCase::Underline()
551 m_rich
->SetValue("text to underline");
553 m_rich
->ApplyUnderlineToSelection();
555 CPPUNIT_ASSERT(m_rich
->IsSelectionUnderlined());
557 m_rich
->BeginUnderline();
558 m_rich
->AddParagraph("underline paragraph");
559 m_rich
->EndUnderline();
560 m_rich
->AddParagraph("not underline paragraph");
562 m_rich
->SetSelection(20, 25);
564 CPPUNIT_ASSERT(m_rich
->IsSelectionUnderlined());
566 m_rich
->SetSelection(40, 45);
568 CPPUNIT_ASSERT(!m_rich
->IsSelectionUnderlined());
571 void RichTextCtrlTestCase::Indent()
573 m_rich
->BeginLeftIndent(12, -5);
574 m_rich
->BeginRightIndent(14);
575 m_rich
->AddParagraph("A paragraph with indents");
576 m_rich
->EndLeftIndent();
577 m_rich
->EndRightIndent();
578 m_rich
->AddParagraph("No more indent");
581 m_rich
->GetStyle(5, indent
);
583 CPPUNIT_ASSERT_EQUAL(12, indent
.GetLeftIndent());
584 CPPUNIT_ASSERT_EQUAL(-5, indent
.GetLeftSubIndent());
585 CPPUNIT_ASSERT_EQUAL(14, indent
.GetRightIndent());
587 m_rich
->GetStyle(35, indent
);
589 CPPUNIT_ASSERT_EQUAL(0, indent
.GetLeftIndent());
590 CPPUNIT_ASSERT_EQUAL(0, indent
.GetLeftSubIndent());
591 CPPUNIT_ASSERT_EQUAL(0, indent
.GetRightIndent());
594 void RichTextCtrlTestCase::LineSpacing()
596 m_rich
->BeginLineSpacing(20);
597 m_rich
->AddParagraph("double spaced");
598 m_rich
->EndLineSpacing();
599 m_rich
->BeginLineSpacing(wxTEXT_ATTR_LINE_SPACING_HALF
);
600 m_rich
->AddParagraph("1.5 spaced");
601 m_rich
->EndLineSpacing();
602 m_rich
->AddParagraph("normally spaced");
605 m_rich
->GetStyle(5, spacing
);
607 CPPUNIT_ASSERT_EQUAL(20, spacing
.GetLineSpacing());
609 m_rich
->GetStyle(20, spacing
);
611 CPPUNIT_ASSERT_EQUAL(15, spacing
.GetLineSpacing());
613 m_rich
->GetStyle(30, spacing
);
615 CPPUNIT_ASSERT_EQUAL(10, spacing
.GetLineSpacing());
618 void RichTextCtrlTestCase::ParagraphSpacing()
620 m_rich
->BeginParagraphSpacing(15, 20);
621 m_rich
->AddParagraph("spaced paragraph");
622 m_rich
->EndParagraphSpacing();
623 m_rich
->AddParagraph("non-spaced paragraph");
626 m_rich
->GetStyle(5, spacing
);
628 CPPUNIT_ASSERT_EQUAL(15, spacing
.GetParagraphSpacingBefore());
629 CPPUNIT_ASSERT_EQUAL(20, spacing
.GetParagraphSpacingAfter());
631 m_rich
->GetStyle(25, spacing
);
633 //Make sure we test against the defaults
634 CPPUNIT_ASSERT_EQUAL(m_rich
->GetBasicStyle().GetParagraphSpacingBefore(),
635 spacing
.GetParagraphSpacingBefore());
636 CPPUNIT_ASSERT_EQUAL(m_rich
->GetBasicStyle().GetParagraphSpacingAfter(),
637 spacing
.GetParagraphSpacingAfter());
640 void RichTextCtrlTestCase::TextColour()
642 m_rich
->BeginTextColour(*wxRED
);
643 m_rich
->AddParagraph("red paragraph");
644 m_rich
->EndTextColour();
645 m_rich
->AddParagraph("default paragraph");
648 m_rich
->GetStyle(5, colour
);
650 CPPUNIT_ASSERT_EQUAL(*wxRED
, colour
.GetTextColour());
652 m_rich
->GetStyle(25, colour
);
654 CPPUNIT_ASSERT_EQUAL(m_rich
->GetBasicStyle().GetTextColour(),
655 colour
.GetTextColour());
658 void RichTextCtrlTestCase::NumberedBullet()
660 m_rich
->BeginNumberedBullet(1, 15, 20);
661 m_rich
->AddParagraph("bullet one");
662 m_rich
->EndNumberedBullet();
663 m_rich
->BeginNumberedBullet(2, 25, -5);
664 m_rich
->AddParagraph("bullet two");
665 m_rich
->EndNumberedBullet();
668 m_rich
->GetStyle(5, bullet
);
670 CPPUNIT_ASSERT(bullet
.HasBulletStyle());
671 CPPUNIT_ASSERT(bullet
.HasBulletNumber());
672 CPPUNIT_ASSERT_EQUAL(1, bullet
.GetBulletNumber());
673 CPPUNIT_ASSERT_EQUAL(15, bullet
.GetLeftIndent());
674 CPPUNIT_ASSERT_EQUAL(20, bullet
.GetLeftSubIndent());
676 m_rich
->GetStyle(15, bullet
);
678 CPPUNIT_ASSERT(bullet
.HasBulletStyle());
679 CPPUNIT_ASSERT(bullet
.HasBulletNumber());
680 CPPUNIT_ASSERT_EQUAL(2, bullet
.GetBulletNumber());
681 CPPUNIT_ASSERT_EQUAL(25, bullet
.GetLeftIndent());
682 CPPUNIT_ASSERT_EQUAL(-5, bullet
.GetLeftSubIndent());
685 void RichTextCtrlTestCase::SymbolBullet()
687 m_rich
->BeginSymbolBullet("*", 15, 20);
688 m_rich
->AddParagraph("bullet one");
689 m_rich
->EndSymbolBullet();
690 m_rich
->BeginSymbolBullet("%", 25, -5);
691 m_rich
->AddParagraph("bullet two");
692 m_rich
->EndSymbolBullet();
695 m_rich
->GetStyle(5, bullet
);
697 CPPUNIT_ASSERT(bullet
.HasBulletStyle());
698 CPPUNIT_ASSERT(bullet
.HasBulletText());
699 CPPUNIT_ASSERT_EQUAL("*", bullet
.GetBulletText());
700 CPPUNIT_ASSERT_EQUAL(15, bullet
.GetLeftIndent());
701 CPPUNIT_ASSERT_EQUAL(20, bullet
.GetLeftSubIndent());
703 m_rich
->GetStyle(15, bullet
);
705 CPPUNIT_ASSERT(bullet
.HasBulletStyle());
706 CPPUNIT_ASSERT(bullet
.HasBulletText());
707 CPPUNIT_ASSERT_EQUAL("%", bullet
.GetBulletText());
708 CPPUNIT_ASSERT_EQUAL(25, bullet
.GetLeftIndent());
709 CPPUNIT_ASSERT_EQUAL(-5, bullet
.GetLeftSubIndent());
712 void RichTextCtrlTestCase::FontSize()
714 m_rich
->BeginFontSize(24);
715 m_rich
->AddParagraph("Large text");
716 m_rich
->EndFontSize();
719 m_rich
->GetStyle(5, size
);
721 CPPUNIT_ASSERT(size
.HasFontSize());
722 CPPUNIT_ASSERT_EQUAL(24, size
.GetFontSize());
725 void RichTextCtrlTestCase::Font()
727 wxFont
font(14, wxFONTFAMILY_DEFAULT
, wxFONTSTYLE_NORMAL
, wxFONTWEIGHT_NORMAL
);
728 m_rich
->BeginFont(font
);
729 m_rich
->AddParagraph("paragraph with font");
732 wxTextAttr fontstyle
;
733 m_rich
->GetStyle(5, fontstyle
);
735 CPPUNIT_ASSERT_EQUAL(font
, fontstyle
.GetFont());
738 void RichTextCtrlTestCase::Delete()
740 m_rich
->AddParagraph("here is a long long line in a paragraph");
741 m_rich
->SetSelection(0, 6);
743 CPPUNIT_ASSERT(m_rich
->CanDeleteSelection());
745 m_rich
->DeleteSelection();
747 CPPUNIT_ASSERT_EQUAL("is a long long line in a paragraph", m_rich
->GetValue());
749 m_rich
->SetSelection(0, 5);
751 CPPUNIT_ASSERT(m_rich
->CanDeleteSelection());
753 m_rich
->DeleteSelectedContent();
755 CPPUNIT_ASSERT_EQUAL("long long line in a paragraph", m_rich
->GetValue());
757 m_rich
->Delete(wxRichTextRange(14, 29));
759 CPPUNIT_ASSERT_EQUAL("long long line", m_rich
->GetValue());
762 void RichTextCtrlTestCase::Url()
764 m_rich
->BeginURL("http://www.wxwidgets.org");
765 m_rich
->WriteText("http://www.wxwidgets.org");
769 m_rich
->GetStyle(5, url
);
771 CPPUNIT_ASSERT(url
.HasURL());
772 CPPUNIT_ASSERT_EQUAL("http://www.wxwidgets.org", url
.GetURL());
775 #endif //wxUSE_RICHTEXT