static void UndoTest2();\r
static void UndoTest3();\r
static void UndoTest4();\r
+static void UndoTest5();\r
\r
void YAEditDocTest(TestRunner *r) {\r
runner = r;\r
UndoTest2();\r
UndoTest3();\r
UndoTest4();\r
+ UndoTest5();\r
}\r
\r
////////////////////////////////////////////////\r
// Undo!\r
ASSERT(pDoc->Undo());\r
\r
+ // expect is -----\r
pResult = pDoc->GetDocumentData(&nLen);\r
ASSERT(pResult != NULL);\r
ASSERT(_tcsncmp(pResult, TEXT("-----"), nLen) == 0);\r
ASSERT(nLen == 5);\r
\r
+}\r
+\r
+void UndoTest5() {\r
+ YAEditDoc *pDoc = new YAEditDoc();\r
+ ASSERT(pDoc->Init(TEXT("-----"), NULL, NULL));\r
+\r
+ // -----\r
+ Region rReplace(2, 0, 2, 0);\r
+ ASSERT(pDoc->ReplaceString(&rReplace, TEXT("a")));\r
+ // --a---\r
+\r
+ // Undo!\r
+ ASSERT(pDoc->Undo());\r
+\r
+ // expect is -----\r
+ DWORD nLen;\r
+ LPTSTR pResult;\r
+ pResult = pDoc->GetDocumentData(&nLen);\r
+ ASSERT(pResult != NULL);\r
+ ASSERT(_tcsncmp(pResult, TEXT("-----"), nLen) == 0);\r
+ ASSERT(nLen == 5);\r
+\r
+ // Undo(exactly say, this is Redo)\r
+ ASSERT(pDoc->Undo());\r
+\r
+ // expect is --a---\r
+ pResult = pDoc->GetDocumentData(&nLen);\r
+ ASSERT(pResult != NULL);\r
+ ASSERT(_tcsncmp(pResult, TEXT("--a---"), nLen) == 0);\r
+ ASSERT(nLen == 6);\r
}
\ No newline at end of file