Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: tests/SkDOMTest.cpp

Issue 2142893006: Dust-off SkXMLParser (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: XML_STATIC for MSVC voodoo Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/xml/SkXMLParser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkDOM.h"
9 #include "Test.h"
10
11 DEF_TEST(SkDOM_test, r) {
12 static const char gDoc[] =
13 "<root a='1' b='2'>"
14 "<elem1 c='3' />"
15 "<elem2 d='4' />"
16 "<elem3 e='5'>"
17 "<subelem1/>"
18 "<subelem2 f='6' g='7'/>"
19 "</elem3>"
20 "<elem4 h='8'/>"
21 "</root>"
22 ;
23
24 SkDOM dom;
25 REPORTER_ASSERT(r, !dom.getRootNode());
26
27 const SkDOM::Node* root = dom.build(gDoc, sizeof(gDoc) - 1);
28 REPORTER_ASSERT(r, root && dom.getRootNode() == root);
29
30 const char* v = dom.findAttr(root, "a");
31 REPORTER_ASSERT(r, v && !strcmp(v, "1"));
32 v = dom.findAttr(root, "b");
33 REPORTER_ASSERT(r, v && !strcmp(v, "2"));
34 v = dom.findAttr(root, "c");
35 REPORTER_ASSERT(r, v == nullptr);
36
37 REPORTER_ASSERT(r, dom.getFirstChild(root, "elem1"));
38 REPORTER_ASSERT(r, !dom.getFirstChild(root, "subelem1"));
39 }
OLDNEW
« no previous file with comments | « src/xml/SkXMLParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698