textrendering/textformatting/test/src/TUndo.cpp
branchRCL_3
changeset 17 336bee5c2d35
parent 16 748ec5531811
equal deleted inserted replaced
16:748ec5531811 17:336bee5c2d35
     1 /*
     1 /*
     2 * Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    33 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    33 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    34 #include <txtclipboard.h>
    34 #include <txtclipboard.h>
    35 #include "txtfmlyr_internal.h"
    35 #include "txtfmlyr_internal.h"
    36 #endif
    36 #endif
    37 
    37 
    38 #include "tundo.h"
       
    39 
       
    40 #define UNUSED_VAR(a) a = a
    38 #define UNUSED_VAR(a) a = a
    41 
    39 
    42 using namespace UndoSystem;
    40 using namespace UndoSystem;
    43 
    41 
    44 namespace
    42 namespace
    45 {
    43 {
    46 CTUndoStep* TestStep = NULL;
    44 CTrapCleanup* TrapCleanup;
    47 #define TESTPOINT(p) TestStep->testpoint(p,(TText8*)__FILE__,__LINE__)
    45 RTest test(_L("TUndo - Undo system"));
    48 #define TESTPRINT(p) TestStep->print(p,(TText8*)__FILE__,__LINE__)
       
    49 }
    46 }
    50 
    47 
    51 //
    48 //
    52 //
    49 //
    53 //  logger
    50 //  logger
  1221 	while (a.Top())
  1218 	while (a.Top())
  1222 		{
  1219 		{
  1223 		CSingleCommand* single = a.Top()->Single();
  1220 		CSingleCommand* single = a.Top()->Single();
  1224 		if (!single)
  1221 		if (!single)
  1225 			{
  1222 			{
  1226             TESTPRINT(_L("CCommandStack : stack unexpectedly contained batches"));
  1223 			test.Printf(_L("CCommandStack : stack unexpectedly contained batches"));
  1227 			a.Reset();
  1224 			a.Reset();
  1228 			return 1;
  1225 			return 1;
  1229 			}
  1226 			}
  1230 		single->ExecuteL();
  1227 		single->ExecuteL();
  1231 		delete single;
  1228 		delete single;
  1235 	}
  1232 	}
  1236 TInt CheckLog(CCheckingLogger& a)
  1233 TInt CheckLog(CCheckingLogger& a)
  1237 	{
  1234 	{
  1238 	if (a.Passed())
  1235 	if (a.Passed())
  1239 		return 0;
  1236 		return 0;
  1240 	TESTPRINT(_L("CCommandStack... : log failed"));
  1237 	test.Printf(_L("CCommandStack... : log failed"));
  1241 	return 1;
  1238 	return 1;
  1242 	}
  1239 	}
  1243 TInt CheckTop(CCommandStack& aStack, CCommand* aTop)
  1240 TInt CheckTop(CCommandStack& aStack, CCommand* aTop)
  1244 	{
  1241 	{
  1245 	if (aStack.Top() != aTop)
  1242 	if (aStack.Top() != aTop)
  1246 		{
  1243 		{
  1247         TESTPRINT(_L("CCommandStack : unexpected item at top of stack"));
  1244 		test.Printf(_L("CCommandStack : unexpected item at top of stack"));
  1248 		return 1;
  1245 		return 1;
  1249 		}
  1246 		}
  1250 	return 0;
  1247 	return 0;
  1251 	}
  1248 	}
  1252 TInt CheckCount(CCommandStack& aStack, TInt aExpectedCount)
  1249 TInt CheckCount(CCommandStack& aStack, TInt aExpectedCount)
  1253 	{
  1250 	{
  1254 	if (aStack.Count() != aExpectedCount)
  1251 	if (aStack.Count() != aExpectedCount)
  1255 		{
  1252 		{
  1256 	    TESTPRINT(_L("CCommandStack : stack an unexpected size"));
  1253 		test.Printf(_L("CCommandStack : stack an unexpected size"));
  1257 		return 1;
  1254 		return 1;
  1258 		}
  1255 		}
  1259 	return 0;
  1256 	return 0;
  1260 	}
  1257 	}
  1261 TInt CheckPop(CCommandStack& aStack)
  1258 TInt CheckPop(CCommandStack& aStack)
  1262 	{
  1259 	{
  1263 	CCommand* check = aStack.Top();
  1260 	CCommand* check = aStack.Top();
  1264 	if (aStack.Pop() != check)
  1261 	if (aStack.Pop() != check)
  1265 		{
  1262 		{
  1266         TESTPRINT(_L("CCommandStack : Pop() does not match Top()"));
  1263 		test.Printf(_L("CCommandStack : Pop() does not match Top()"));
  1267 		return 1;
  1264 		return 1;
  1268 		}
  1265 		}
  1269 	return 0;
  1266 	return 0;
  1270 	}
  1267 	}
  1271 void AddStuffL(CCommandStack& aStack, TInt* aTarget, CLogger* aLog)
  1268 void AddStuffL(CCommandStack& aStack, TInt* aTarget, CLogger* aLog)
  1393 		{
  1390 		{
  1394 		CSingleCommand* single = a.Top();
  1391 		CSingleCommand* single = a.Top();
  1395 		single->ExecuteL();
  1392 		single->ExecuteL();
  1396 		if (a.Pop() != single)
  1393 		if (a.Pop() != single)
  1397 			{
  1394 			{
  1398             TESTPRINT(_L("CBatchCommand : Pop() didn't match Top()"));
  1395 			test.Printf(_L("CBatchCommand : Pop() didn't match Top()"));
  1399             TESTPOINT(0);
  1396 			test(0);
  1400 			}
  1397 			}
  1401 		delete single;
  1398 		delete single;
  1402 		}
  1399 		}
  1403 	TESTPOINT(1);
  1400 	test(1);
  1404 	}
  1401 	}
  1405 void CheckTop(CBatchCommand& aBatch, CCommand* aTop)
  1402 void CheckTop(CBatchCommand& aBatch, CCommand* aTop)
  1406 	{
  1403 	{
  1407 	if (aBatch.Top() != aTop)
  1404 	if (aBatch.Top() != aTop)
  1408 		{
  1405 		{
  1409         TESTPRINT(_L("CCommandBatch : unexpected item at top of stack"));
  1406 		test.Printf(_L("CCommandBatch : unexpected item at top of stack"));
  1410         TESTPOINT(0);
  1407 		test(0);
  1411 		}
  1408 		}
  1412 	TESTPOINT(1);
  1409 	test(1);
  1413 	}
  1410 	}
  1414 void TestCBatchCommandL()
  1411 void TestCBatchCommandL()
  1415 	{
  1412 	{
  1416 	__UHEAP_MARK;
  1413 	__UHEAP_MARK;
  1417 	TInt target = 0;
  1414 	TInt target = 0;
  1532 			aHistory.Top()->Single()->ExecuteL();
  1529 			aHistory.Top()->Single()->ExecuteL();
  1533 			}
  1530 			}
  1534 		else
  1531 		else
  1535 			{
  1532 			{
  1536 			CBatchCommand* batch = aHistory.Top()->Batch();
  1533 			CBatchCommand* batch = aHistory.Top()->Batch();
  1537 			TESTPOINT(batch != 0);
  1534 			test(batch != 0);
  1538 			aLog << _L("batch{");
  1535 			aLog << _L("batch{");
  1539 			ExecuteBatchL(*batch);
  1536 			ExecuteBatchL(*batch);
  1540 			aLog << _L("}");
  1537 			aLog << _L("}");
  1541 			}
  1538 			}
  1542 		delete aHistory.Pop();
  1539 		delete aHistory.Pop();
  1607 // 4 - CCommandManager test
  1604 // 4 - CCommandManager test
  1608 void TestCanUndo(const CCommandManager& aMan)
  1605 void TestCanUndo(const CCommandManager& aMan)
  1609 	{
  1606 	{
  1610 	if (aMan.CanUndo())
  1607 	if (aMan.CanUndo())
  1611 		{
  1608 		{
  1612         TESTPOINT(1);
  1609 		test(1);
  1613 		return;
  1610 		return;
  1614 		}
  1611 		}
  1615 	TESTPRINT(_L("CCommandManager : unexpectedly could not undo"));
  1612 	test.Printf(_L("CCommandManager : unexpectedly could not undo"));
  1616 	TESTPOINT(0);
  1613 	test(0);
  1617 	}
  1614 	}
  1618 void TestCanRedo(const CCommandManager& aMan)
  1615 void TestCanRedo(const CCommandManager& aMan)
  1619 	{
  1616 	{
  1620 	if (aMan.CanRedo())
  1617 	if (aMan.CanRedo())
  1621 		{
  1618 		{
  1622         TESTPOINT(1);
  1619 		test(1);
  1623 		return;
  1620 		return;
  1624 		}
  1621 		}
  1625 	TESTPRINT(_L("CCommandManager : unexpectedly could not redo"));
  1622 	test.Printf(_L("CCommandManager : unexpectedly could not redo"));
  1626 	TESTPOINT(0);
  1623 	test(0);
  1627 	}
  1624 	}
  1628 void TestCannotUndo(const CCommandManager& aMan)
  1625 void TestCannotUndo(const CCommandManager& aMan)
  1629 	{
  1626 	{
  1630 	if (!aMan.CanUndo())
  1627 	if (!aMan.CanUndo())
  1631 		{
  1628 		{
  1632         TESTPOINT(1);
  1629 		test(1);
  1633 		return;
  1630 		return;
  1634 		}
  1631 		}
  1635 	TESTPRINT(_L("CCommandManager : unexpectedly could undo"));
  1632 	test.Printf(_L("CCommandManager : unexpectedly could undo"));
  1636 	TESTPOINT(0);
  1633 	test(0);
  1637 	}
  1634 	}
  1638 void TestCannotRedo(const CCommandManager& aMan)
  1635 void TestCannotRedo(const CCommandManager& aMan)
  1639 	{
  1636 	{
  1640 	if (!aMan.CanRedo())
  1637 	if (!aMan.CanRedo())
  1641 		{
  1638 		{
  1642         TESTPOINT(1);
  1639 		test(1);
  1643 		return;
  1640 		return;
  1644 		}
  1641 		}
  1645 	TESTPRINT(_L("CCommandManager : unexpectedly could undo"));
  1642 	test.Printf(_L("CCommandManager : unexpectedly could undo"));
  1646 	TESTPOINT(0);
  1643 	test(0);
  1647 	}
  1644 	}
  1648 void SetUpTestL(CCommandManager& aMan, CSingleCommand& aCommand, TInt* aTarget, CLogger* aLogger)
  1645 void SetUpTestL(CCommandManager& aMan, CSingleCommand& aCommand, TInt* aTarget, CLogger* aLogger)
  1649 	{
  1646 	{
  1650 	CCommandIncProto* inc = CCommandIncProto::NewL(aTarget, aLogger);
  1647 	CCommandIncProto* inc = CCommandIncProto::NewL(aTarget, aLogger);
  1651 	CleanupStack::PushL(inc);
  1648 	CleanupStack::PushL(inc);
  1670 TInt CheckErrorCode(TInt aErr, TInt aExpected)
  1667 TInt CheckErrorCode(TInt aErr, TInt aExpected)
  1671 	{
  1668 	{
  1672 	if (aErr == aExpected)
  1669 	if (aErr == aExpected)
  1673 		return 0;
  1670 		return 0;
  1674 	if (aErr == KErrNone)
  1671 	if (aErr == KErrNone)
  1675 	    TESTPRINT(_L("CCommandManager : no leave where one was expected"));
  1672 		test.Printf(_L("CCommandManager : no leave where one was expected"));
  1676 	else
  1673 	else
  1677 	    TESTPRINT(_L("CCommandManager : unexpected leave code"));
  1674 		test.Printf(_L("CCommandManager : unexpected leave code"));
  1678 	return 1;
  1675 	return 1;
  1679 	}
  1676 	}
  1680 void TestCCommandManagerL()
  1677 void TestCCommandManagerL()
  1681 	{
  1678 	{
  1682 	__UHEAP_MARK;
  1679 	__UHEAP_MARK;
  1997 
  1994 
  1998 void CheckEditorLog(CCheckingLogger& a)
  1995 void CheckEditorLog(CCheckingLogger& a)
  1999 	{
  1996 	{
  2000 	if (a.Passed())
  1997 	if (a.Passed())
  2001 		{
  1998 		{
  2002 	    TESTPOINT(1);
  1999 		test(1);
  2003 		return;
  2000 		return;
  2004 		}
  2001 		}
  2005 	TESTPRINT(_L("EditorUndo : log failed"));
  2002 	test.Printf(_L("EditorUndo : log failed"));
  2006 	TESTPOINT(0);
  2003 	test(0);
  2007 	}
  2004 	}
  2008 
  2005 
  2009 void TestPlainText(CTestEditor& aTestEditor, MUnifiedEditor& aUndoEditor,
  2006 void TestPlainText(CTestEditor& aTestEditor, MUnifiedEditor& aUndoEditor,
  2010 				   CCommandManager& aCommandManager)
  2007 				   CCommandManager& aCommandManager)
  2011 	{
  2008 	{
  2793 	TInt retval = ed->StyleSupport()->SetStyleL(1, 3, _L("author"));
  2790 	TInt retval = ed->StyleSupport()->SetStyleL(1, 3, _L("author"));
  2794 	testEd->Print(*log);
  2791 	testEd->Print(*log);
  2795 	styleLog2 = log->GetStore();
  2792 	styleLog2 = log->GetStore();
  2796 	if (retval != KErrNone)
  2793 	if (retval != KErrNone)
  2797 		{
  2794 		{
  2798         TESTPRINT(_L("EditorUndo : apply style failed"));
  2795 		test.Printf(_L("EditorUndo : apply style failed"));
  2799         TESTPOINT(0);
  2796 		test(0);
  2800 		}
  2797 		}
  2801 	TPtrC testStyleName;
  2798 	TPtrC testStyleName;
  2802 	TInt testStyleRunLength;
  2799 	TInt testStyleRunLength;
  2803 	ed->StyleSupport()->GetStyle(1, testStyleName, testStyleRunLength);
  2800 	ed->StyleSupport()->GetStyle(1, testStyleName, testStyleRunLength);
  2804 	if (testStyleRunLength != 3 || testStyleName != style1.iName)
  2801 	if (testStyleRunLength != 3 || testStyleName != style1.iName)
  2805 		{
  2802 		{
  2806         TESTPRINT(_L("EditorUndo : apply style failed"));
  2803 		test.Printf(_L("EditorUndo : apply style failed"));
  2807 		TESTPOINT(0);
  2804 		test(0);
  2808 		}
  2805 		}
  2809 	ed->InsertTextL(5, _L(","), &style1.iName, 0, 0);
  2806 	ed->InsertTextL(5, _L(","), &style1.iName, 0, 0);
  2810 	testEd->Print(*log);
  2807 	testEd->Print(*log);
  2811 	styleLog3 = log->GetStore();
  2808 	styleLog3 = log->GetStore();
  2812 	ed->StyleSupport()->CreateStyleL(style2);
  2809 	ed->StyleSupport()->CreateStyleL(style2);
  2833 	retval = ed->StyleSupport()->SetStyleL(10, 1, _L("version"));
  2830 	retval = ed->StyleSupport()->SetStyleL(10, 1, _L("version"));
  2834 	testEd->Print(*log);
  2831 	testEd->Print(*log);
  2835 	styleLog10 = log->GetStore();
  2832 	styleLog10 = log->GetStore();
  2836 	if (retval != KErrNone)
  2833 	if (retval != KErrNone)
  2837 		{
  2834 		{
  2838         TESTPRINT(_L("EditorUndo : rename style failed"));
  2835 		test.Printf(_L("EditorUndo : rename style failed"));
  2839 		TESTPOINT(0);
  2836 		test(0);
  2840 		}
  2837 		}
  2841 	ed->StyleSupport()->GetStyle(1, testStyleName, testStyleRunLength);
  2838 	ed->StyleSupport()->GetStyle(1, testStyleName, testStyleRunLength);
  2842 	if (testStyleRunLength != 1 || testStyleName != style1.iName)
  2839 	if (testStyleRunLength != 1 || testStyleName != style1.iName)
  2843 		{
  2840 		{
  2844         TESTPRINT(_L("EditorUndo : rename or apply style failed"));
  2841 		test.Printf(_L("EditorUndo : rename or apply style failed"));
  2845 		TESTPOINT(0);
  2842 		test(0);
  2846 		}
  2843 		}
  2847 	ed->StyleSupport()->RenameStyleL(_L("title"), _L("zip"));
  2844 	ed->StyleSupport()->RenameStyleL(_L("title"), _L("zip"));
  2848 	style2.iName = _L("zip");
  2845 	style2.iName = _L("zip");
  2849 	testEd->Print(*log);
  2846 	testEd->Print(*log);
  2850 	styleLog11 = log->GetStore();
  2847 	styleLog11 = log->GetStore();
  3170 		ed->UndoL();
  3167 		ed->UndoL();
  3171 		// coalescence should have happenned unless there is a bookmark
  3168 		// coalescence should have happenned unless there is a bookmark
  3172 		// in the way.
  3169 		// in the way.
  3173 		if (i == 5)
  3170 		if (i == 5)
  3174 			{
  3171 			{
  3175             TESTPOINT(manager->IsAtBookmark());
  3172 			test(manager->IsAtBookmark());
  3176 			check->SetCheckString(*bookMarkLog4);
  3173 			check->SetCheckString(*bookMarkLog4);
  3177 			testEd->Print(*check);
  3174 			testEd->Print(*check);
  3178 			CheckEditorLog(*check);
  3175 			CheckEditorLog(*check);
  3179 			ed->UndoL();
  3176 			ed->UndoL();
  3180 			}
  3177 			}
  3181 		if (i == 4)
  3178 		if (i == 4)
  3182 		    TESTPOINT(manager->IsAtBookmark());
  3179 			test(manager->IsAtBookmark());
  3183 		else
  3180 		else
  3184 		    TESTPOINT(!manager->IsAtBookmark());
  3181 			test(!manager->IsAtBookmark());
  3185 		check->SetCheckString(*bookMarkLog3);
  3182 		check->SetCheckString(*bookMarkLog3);
  3186 		testEd->Print(*check);
  3183 		testEd->Print(*check);
  3187 		CheckEditorLog(*check);
  3184 		CheckEditorLog(*check);
  3188 		ed->UndoL();
  3185 		ed->UndoL();
  3189 		if (i == 2)
  3186 		if (i == 2)
  3190 		    TESTPOINT(manager->IsAtBookmark());
  3187 			test(manager->IsAtBookmark());
  3191 		else
  3188 		else
  3192 		    TESTPOINT(!manager->IsAtBookmark());
  3189 			test(!manager->IsAtBookmark());
  3193 		check->SetCheckString(*bookMarkLog2);
  3190 		check->SetCheckString(*bookMarkLog2);
  3194 		testEd->Print(*check);
  3191 		testEd->Print(*check);
  3195 		CheckEditorLog(*check);
  3192 		CheckEditorLog(*check);
  3196 		ed->UndoL();
  3193 		ed->UndoL();
  3197 		if (i == 1)
  3194 		if (i == 1)
  3198 		    TESTPOINT(manager->IsAtBookmark());
  3195 			test(manager->IsAtBookmark());
  3199 		else
  3196 		else
  3200 		    TESTPOINT(!manager->IsAtBookmark());
  3197 			test(!manager->IsAtBookmark());
  3201 		check->SetCheckString(*bookMarkLog1);
  3198 		check->SetCheckString(*bookMarkLog1);
  3202 		testEd->Print(*check);
  3199 		testEd->Print(*check);
  3203 		CheckEditorLog(*check);
  3200 		CheckEditorLog(*check);
  3204 		ed->UndoL();
  3201 		ed->UndoL();
  3205 		if (i == 0)
  3202 		if (i == 0)
  3206 		    TESTPOINT(manager->IsAtBookmark());
  3203 			test(manager->IsAtBookmark());
  3207 		else
  3204 		else
  3208 		    TESTPOINT(!manager->IsAtBookmark());
  3205 			test(!manager->IsAtBookmark());
  3209 		check->SetCheckString(*bookMarkLog0);
  3206 		check->SetCheckString(*bookMarkLog0);
  3210 		testEd->Print(*check);
  3207 		testEd->Print(*check);
  3211 		CheckEditorLog(*check);
  3208 		CheckEditorLog(*check);
  3212 		TESTPOINT(!ed->CanUndo());
  3209 		test(!ed->CanUndo());
  3213 		ed->RedoL();
  3210 		ed->RedoL();
  3214 		if (i == 1)
  3211 		if (i == 1)
  3215 		    TESTPOINT(manager->IsAtBookmark());
  3212 			test(manager->IsAtBookmark());
  3216 		else
  3213 		else
  3217 		    TESTPOINT(!manager->IsAtBookmark());
  3214 			test(!manager->IsAtBookmark());
  3218 		check->SetCheckString(*bookMarkLog1);
  3215 		check->SetCheckString(*bookMarkLog1);
  3219 		testEd->Print(*check);
  3216 		testEd->Print(*check);
  3220 		CheckEditorLog(*check);
  3217 		CheckEditorLog(*check);
  3221 		ed->RedoL();
  3218 		ed->RedoL();
  3222 		if (i == 2)
  3219 		if (i == 2)
  3223 		    TESTPOINT(manager->IsAtBookmark());
  3220 			test(manager->IsAtBookmark());
  3224 		else
  3221 		else
  3225 		    TESTPOINT(!manager->IsAtBookmark());
  3222 			test(!manager->IsAtBookmark());
  3226 		check->SetCheckString(*bookMarkLog2);
  3223 		check->SetCheckString(*bookMarkLog2);
  3227 		testEd->Print(*check);
  3224 		testEd->Print(*check);
  3228 		CheckEditorLog(*check);
  3225 		CheckEditorLog(*check);
  3229 		ed->RedoL();
  3226 		ed->RedoL();
  3230 		if (i == 4)
  3227 		if (i == 4)
  3231 		    TESTPOINT(manager->IsAtBookmark());
  3228 			test(manager->IsAtBookmark());
  3232 		else
  3229 		else
  3233 		    TESTPOINT(!manager->IsAtBookmark());
  3230 			test(!manager->IsAtBookmark());
  3234 		check->SetCheckString(*bookMarkLog3);
  3231 		check->SetCheckString(*bookMarkLog3);
  3235 		testEd->Print(*check);
  3232 		testEd->Print(*check);
  3236 		CheckEditorLog(*check);
  3233 		CheckEditorLog(*check);
  3237 		ed->RedoL();
  3234 		ed->RedoL();
  3238 		if (i == 5)
  3235 		if (i == 5)
  3239 			{
  3236 			{
  3240             TESTPOINT(manager->IsAtBookmark());
  3237 			test(manager->IsAtBookmark());
  3241 			check->SetCheckString(*bookMarkLog4);
  3238 			check->SetCheckString(*bookMarkLog4);
  3242 			testEd->Print(*check);
  3239 			testEd->Print(*check);
  3243 			CheckEditorLog(*check);
  3240 			CheckEditorLog(*check);
  3244 			ed->RedoL();
  3241 			ed->RedoL();
  3245 			}
  3242 			}
  3246 		TESTPOINT(!ed->CanRedo());
  3243 		test(!ed->CanRedo());
  3247 		if (i == 6)
  3244 		if (i == 6)
  3248 		    TESTPOINT(manager->IsAtBookmark());
  3245 			test(manager->IsAtBookmark());
  3249 		else
  3246 		else
  3250 		    TESTPOINT(!manager->IsAtBookmark());
  3247 			test(!manager->IsAtBookmark());
  3251 
  3248 
  3252 		delete bookMarkLog0;
  3249 		delete bookMarkLog0;
  3253 		delete bookMarkLog1;
  3250 		delete bookMarkLog1;
  3254 		delete bookMarkLog2;
  3251 		delete bookMarkLog2;
  3255 		delete bookMarkLog3;
  3252 		delete bookMarkLog3;
  3438 
  3435 
  3439 	//Getting the base format to check if it is set accordingly
  3436 	//Getting the base format to check if it is set accordingly
  3440 	TTmCharFormat charB1;
  3437 	TTmCharFormat charB1;
  3441 	RTmParFormat parT1;
  3438 	RTmParFormat parT1;
  3442 	ed0->GetBaseFormatL(charB1,parT1);
  3439 	ed0->GetBaseFormatL(charB1,parT1);
  3443 	TESTPOINT(charB1==charB);
  3440 	test(charB1==charB);
  3444 	TESTPOINT(parT1==parT);
  3441 	test(parT1==parT);
  3445 
  3442 
  3446 	//Getting the character format
  3443 	//Getting the character format
  3447 	TTmCharFormatLayer charLayer1;
  3444 	TTmCharFormatLayer charLayer1;
  3448 	MUnifiedEditor::TFormatLevel level=MUnifiedEditor::EEffective;
  3445 	MUnifiedEditor::TFormatLevel level=MUnifiedEditor::EEffective;
  3449 	TInt runLen=10;
  3446 	TInt runLen=10;
  3454 	ed0->GetParFormatL(0,level,parLayer1,runLen);
  3451 	ed0->GetParFormatL(0,level,parLayer1,runLen);
  3455 
  3452 
  3456 	//Getting the text
  3453 	//Getting the text
  3457 	TPtrC text;
  3454 	TPtrC text;
  3458 	ed0->GetText(0,text);
  3455 	ed0->GetText(0,text);
  3459 	TESTPOINT(text==_L("a"));
  3456 	test(text==_L("a"));
  3460 
  3457 
  3461 	//Deleting the formating
  3458 	//Deleting the formating
  3462 	ed0->DeleteCharFormatL(0,1);
  3459 	ed0->DeleteCharFormatL(0,1);
  3463 	ed0->DeleteParFormatL(0,1);
  3460 	ed0->DeleteParFormatL(0,1);
  3464 
  3461 
  3542 //
  3539 //
  3543 //  Main
  3540 //  Main
  3544 //
  3541 //
  3545 //
  3542 //
  3546 
  3543 
  3547 TVerdict CTUndoStep::doTestStepL()
  3544 void RunTests()
  3548 	{
  3545 	{
  3549     SetTestStepResult(EPass);
  3546 	__UHEAP_MARK;
  3550     TestStep = this;
  3547 
  3551     TESTPRINT(_L("TUndo - Undo system"));
  3548 	test.Title();
  3552     
  3549 	test.Start(_L("@SYMTestCaseID:SYSLIB-FORM-LEGACY-UNDO-0001 Undo System Tests: "));
  3553     __UHEAP_MARK;
  3550 
  3554     TESTPRINT(_L("@SYMTestCaseID:SYSLIB-FORM-LEGACY-UNDO-0001 Undo System Tests: "));
       
  3555 	
       
  3556 	// test of general undo system components
  3551 	// test of general undo system components
  3557 	TestCCommandStackL();
  3552 	TestCCommandStackL();
  3558 	TestCBatchCommandL();
  3553 	TestCBatchCommandL();
  3559 	TestCCommandHistoryL();
  3554 	TestCCommandHistoryL();
  3560 	TestCCommandManagerL();
  3555 	TestCCommandManagerL();
  3563 	TestEditorUndoL();
  3558 	TestEditorUndoL();
  3564 
  3559 
  3565 	// test that command manager and multiple editors integrate correctly
  3560 	// test that command manager and multiple editors integrate correctly
  3566 	TestMultipleEditorsL();
  3561 	TestMultipleEditorsL();
  3567 
  3562 
       
  3563 	test.End();
       
  3564 	test.Close();
       
  3565 
  3568 	__UHEAP_MARKENDC(0);
  3566 	__UHEAP_MARKENDC(0);
  3569 	
       
  3570 	return TestStepResult();
       
  3571 	}
  3567 	}
  3572 
  3568 
       
  3569 TInt E32Main()
       
  3570 	{
       
  3571 	TrapCleanup = CTrapCleanup::New();
       
  3572 	TRAPD(err, RunTests());
       
  3573     test(err == KErrNone);
       
  3574 	delete TrapCleanup;
       
  3575 	return 0;
       
  3576 	}