diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-10-21 17:56:45 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2016-10-26 19:30:23 -0700 |
commit | ce5e56e243d262a9b65459c3bd0bb9eaadd40628 (patch) | |
tree | cf0ecea98883d090d8d2856fc6d32046c7e3d9e8 /tools/aapt2/ValueVisitor_test.cpp | |
parent | 0f7cc4dc2c49a30c072cbc7aa6c0c5d5c31496d4 (diff) |
AAPT2: Rename to match new style
Use Google3 naming style to match new
projects' and open source google projects' style.
Preferred to do this in a massive CL so as to avoid
style inconsistencies that plague legacy code bases.
This is a relatively NEW code base, may as well keep
it up to date.
Test: name/style refactor - existing tests pass
Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
Diffstat (limited to 'tools/aapt2/ValueVisitor_test.cpp')
-rw-r--r-- | tools/aapt2/ValueVisitor_test.cpp | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/tools/aapt2/ValueVisitor_test.cpp b/tools/aapt2/ValueVisitor_test.cpp index ed9c7f6c8050..eb75b102e427 100644 --- a/tools/aapt2/ValueVisitor_test.cpp +++ b/tools/aapt2/ValueVisitor_test.cpp @@ -15,40 +15,41 @@ */ #include "ValueVisitor.h" + +#include <string> + #include "ResourceValues.h" #include "test/Test.h" #include "util/Util.h" -#include <string> - namespace aapt { struct SingleReferenceVisitor : public ValueVisitor { - using ValueVisitor::visit; + using ValueVisitor::Visit; Reference* visited = nullptr; - void visit(Reference* ref) override { visited = ref; } + void Visit(Reference* ref) override { visited = ref; } }; struct StyleVisitor : public ValueVisitor { - using ValueVisitor::visit; + using ValueVisitor::Visit; - std::list<Reference*> visitedRefs; - Style* visitedStyle = nullptr; + std::list<Reference*> visited_refs; + Style* visited_style = nullptr; - void visit(Reference* ref) override { visitedRefs.push_back(ref); } + void Visit(Reference* ref) override { visited_refs.push_back(ref); } - void visit(Style* style) override { - visitedStyle = style; - ValueVisitor::visit(style); + void Visit(Style* style) override { + visited_style = style; + ValueVisitor::Visit(style); } }; TEST(ValueVisitorTest, VisitsReference) { Reference ref(ResourceName{"android", ResourceType::kAttr, "foo"}); SingleReferenceVisitor visitor; - ref.accept(&visitor); + ref.Accept(&visitor); EXPECT_EQ(visitor.visited, &ref); } @@ -56,31 +57,31 @@ TEST(ValueVisitorTest, VisitsReference) { TEST(ValueVisitorTest, VisitsReferencesInStyle) { std::unique_ptr<Style> style = test::StyleBuilder() - .setParent("android:style/foo") - .addItem("android:attr/one", test::buildReference("android:id/foo")) - .build(); + .SetParent("android:style/foo") + .AddItem("android:attr/one", test::BuildReference("android:id/foo")) + .Build(); StyleVisitor visitor; - style->accept(&visitor); + style->Accept(&visitor); - ASSERT_EQ(style.get(), visitor.visitedStyle); + ASSERT_EQ(style.get(), visitor.visited_style); // Entry attribute references, plus the parent reference, plus one value // reference. - ASSERT_EQ(style->entries.size() + 2, visitor.visitedRefs.size()); + ASSERT_EQ(style->entries.size() + 2, visitor.visited_refs.size()); } TEST(ValueVisitorTest, ValueCast) { - std::unique_ptr<Reference> ref = test::buildReference("android:color/white"); - EXPECT_NE(valueCast<Reference>(ref.get()), nullptr); + std::unique_ptr<Reference> ref = test::BuildReference("android:color/white"); + EXPECT_NE(ValueCast<Reference>(ref.get()), nullptr); std::unique_ptr<Style> style = test::StyleBuilder() - .addItem("android:attr/foo", - test::buildReference("android:color/black")) - .build(); - EXPECT_NE(valueCast<Style>(style.get()), nullptr); - EXPECT_EQ(valueCast<Reference>(style.get()), nullptr); + .AddItem("android:attr/foo", + test::BuildReference("android:color/black")) + .Build(); + EXPECT_NE(ValueCast<Style>(style.get()), nullptr); + EXPECT_EQ(ValueCast<Reference>(style.get()), nullptr); } } // namespace aapt |