|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file CXmlEngNodeTestReplaceWith.cpp |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #include "CXmlEngNodeTestReplaceWith.h" |
|
22 |
|
23 #include <xml/dom/xmlengdomutils.h> |
|
24 #include <xml/dom/xmlengdomimplementation.h> |
|
25 #include <xml/dom/xmlengdocument.h> |
|
26 |
|
27 /** |
|
28 * Class CXmlEngDOMUtilStep1 Implementation |
|
29 */ |
|
30 CXmlEngNodeTestReplaceWith::CXmlEngNodeTestReplaceWith(const TDesC& aStepName) |
|
31 { |
|
32 //Set the test step name in the base class |
|
33 SetTestStepName(aStepName); |
|
34 } |
|
35 |
|
36 TVerdict CXmlEngNodeTestReplaceWith::doTestStepL(void) |
|
37 { |
|
38 if (TestStepName() == KXmlEngNodeTestReplaceWithStep) |
|
39 { |
|
40 INFO_PRINTF1(KXmlEngNodeTestReplaceWithStep); |
|
41 SetTestStepResult(TestKXmlEngTestReplace()); |
|
42 } |
|
43 |
|
44 return TestStepResult(); |
|
45 } |
|
46 |
|
47 |
|
48 TVerdict CXmlEngNodeTestReplaceWith::TestKXmlEngTestReplace() |
|
49 { |
|
50 TInt err = KErrNone; |
|
51 _LIT8(KLit1, "asdfds"); |
|
52 _LIT8(KLit2, "xzcvcv"); |
|
53 _LIT8(KLit3, "lklklk"); |
|
54 TBufC8<30> aLocalName(KLit1); |
|
55 TBufC8<30> aNamespaceUri(KLit2); |
|
56 TBufC8<30> aPrefix(KLit3); |
|
57 |
|
58 RXmlEngDOMImplementation domImpl; |
|
59 domImpl.OpenL(); |
|
60 |
|
61 RXmlEngDocument doc; |
|
62 doc.OpenL(domImpl); |
|
63 |
|
64 TXmlEngElement aElement = doc.CreateElementL(aLocalName, aNamespaceUri, aPrefix); |
|
65 TXmlEngElement bElement = doc.CreateElementL(aNamespaceUri, aLocalName, aPrefix); |
|
66 |
|
67 //For code coverage |
|
68 TRAP(err, aElement.ReplaceWithL(bElement)); |
|
69 |
|
70 doc.Close(); |
|
71 domImpl.Close(); |
|
72 |
|
73 if (KErrNone != err) |
|
74 { |
|
75 return EFail; |
|
76 } |
|
77 |
|
78 return EPass; |
|
79 } |
|
80 |