Landing editor API changes. Removed nsITextEditor and nsTextEditor, split interfaces into more, non-overlapping interfaces, and other general cleanup.

git-svn-id: svn://10.0.0.236/trunk@42725 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sfraser%netscape.com
1999-08-09 01:37:50 +00:00
parent 71e4b293c3
commit 4dd92661ce
55 changed files with 14219 additions and 9761 deletions

View File

@@ -17,7 +17,7 @@
*/
#include <stdio.h>
#include "nsITextEditor.h"
#include "nsIEditor.h"
#include "TextEditorTest.h"
#include "nsIDOMSelection.h"
@@ -43,7 +43,7 @@ TextEditorTest::~TextEditorTest()
printf("destroyed a TextEditorTest\n");
}
void TextEditorTest::Run(nsITextEditor *aEditor, PRInt32 *outNumTests, PRInt32 *outNumTestsFailed)
void TextEditorTest::Run(nsIEditor *aEditor, PRInt32 *outNumTests, PRInt32 *outNumTestsFailed)
{
if (!aEditor) return;
mTextEditor = do_QueryInterface(aEditor);
@@ -98,9 +98,9 @@ nsresult TextEditorTest::RunUnitTest(PRInt32 *outNumTests, PRInt32 *outNumTestsF
nsresult TextEditorTest::InitDoc()
{
nsresult result = mTextEditor->SelectAll();
nsresult result = mEditor->SelectAll();
TEST_RESULT(result);
result = mTextEditor->DeleteSelection(nsIEditor::eDeleteRight);
result = mEditor->DeleteSelection(nsIEditor::eDeleteNext);
TEST_RESULT(result);
return result;
}
@@ -165,14 +165,14 @@ nsresult TextEditorTest::TestTextProperties()
PRBool any = PR_FALSE;
PRBool all = PR_FALSE;
PRBool first=PR_FALSE;
result = mTextEditor->GetTextProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
result = mTextEditor->GetInlineProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
TEST_RESULT(result);
NS_ASSERTION(PR_FALSE==first, "first should be false");
NS_ASSERTION(PR_FALSE==any, "any should be false");
NS_ASSERTION(PR_FALSE==all, "all should be false");
result = mTextEditor->SetTextProperty(nsIEditProperty::b, nsnull, nsnull);
result = mTextEditor->SetInlineProperty(nsIEditProperty::b, nsnull, nsnull);
TEST_RESULT(result);
result = mTextEditor->GetTextProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
result = mTextEditor->GetInlineProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
TEST_RESULT(result);
NS_ASSERTION(PR_TRUE==first, "first should be true");
NS_ASSERTION(PR_TRUE==any, "any should be true");
@@ -181,9 +181,9 @@ nsresult TextEditorTest::TestTextProperties()
// remove the bold we just set
printf("set the whole first text node to not bold\n");
result = mTextEditor->RemoveTextProperty(nsIEditProperty::b, nsnull);
result = mTextEditor->RemoveInlineProperty(nsIEditProperty::b, nsnull);
TEST_RESULT(result);
result = mTextEditor->GetTextProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
result = mTextEditor->GetInlineProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
TEST_RESULT(result);
NS_ASSERTION(PR_FALSE==first, "first should be false");
NS_ASSERTION(PR_FALSE==any, "any should be false");
@@ -194,23 +194,23 @@ nsresult TextEditorTest::TestTextProperties()
printf("set the first text node (1, length-1) to bold and italic, and (2, length-1) to underline.\n");
selection->Collapse(textNode, 1);
selection->Extend(textNode, length-1);
result = mTextEditor->SetTextProperty(nsIEditProperty::b, nsnull, nsnull);
result = mTextEditor->SetInlineProperty(nsIEditProperty::b, nsnull, nsnull);
TEST_RESULT(result);
result = mTextEditor->GetTextProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
result = mTextEditor->GetInlineProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
TEST_RESULT(result);
NS_ASSERTION(PR_TRUE==first, "first should be true");
NS_ASSERTION(PR_TRUE==any, "any should be true");
NS_ASSERTION(PR_TRUE==all, "all should be true");
mEditor->DebugDumpContent();
// make all that same text italic
result = mTextEditor->SetTextProperty(nsIEditProperty::i, nsnull, nsnull);
result = mTextEditor->SetInlineProperty(nsIEditProperty::i, nsnull, nsnull);
TEST_RESULT(result);
result = mTextEditor->GetTextProperty(nsIEditProperty::i, nsnull, nsnull, first, any, all);
result = mTextEditor->GetInlineProperty(nsIEditProperty::i, nsnull, nsnull, first, any, all);
TEST_RESULT(result);
NS_ASSERTION(PR_TRUE==first, "first should be true");
NS_ASSERTION(PR_TRUE==any, "any should be true");
NS_ASSERTION(PR_TRUE==all, "all should be true");
result = mTextEditor->GetTextProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
result = mTextEditor->GetInlineProperty(nsIEditProperty::b, nsnull, nsnull, first, any, all);
TEST_RESULT(result);
NS_ASSERTION(PR_TRUE==first, "first should be true");
NS_ASSERTION(PR_TRUE==any, "any should be true");
@@ -231,9 +231,9 @@ nsresult TextEditorTest::TestTextProperties()
NS_ASSERTION(length==249, "wrong text node");
selection->Collapse(textNode, 1);
selection->Extend(textNode, length-2);
result = mTextEditor->SetTextProperty(nsIEditProperty::u, nsnull, nsnull);
result = mTextEditor->SetInlineProperty(nsIEditProperty::u, nsnull, nsnull);
TEST_RESULT(result);
result = mTextEditor->GetTextProperty(nsIEditProperty::u, nsnull, nsnull, first, any, all);
result = mTextEditor->GetInlineProperty(nsIEditProperty::u, nsnull, nsnull, first, any, all);
TEST_RESULT(result);
NS_ASSERTION(PR_TRUE==first, "first should be true");
NS_ASSERTION(PR_TRUE==any, "any should be true");