diff options
author | Adam Lesinski <adamlesinski@google.com> | 2017-08-02 14:57:43 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2017-09-14 11:30:29 -0700 |
commit | 5b54ca2d72c410aa34363b0f3bb0fe1666954aea (patch) | |
tree | ec1da3d9faf69a18dc3cd04a3cbbe0e093c058ca /tools/aapt2/xml/XmlDom_test.cpp | |
parent | cb1e6f95ae02a8670a85d50db8dc95a8bbb3622d (diff) |
AAPT2: Fix windows unicode path issues
Mingw64 was being difficult, so instead of defining a wmain entrypoint,
the command line parameters are parsed manually using built-in Windows
methods that support Unicode. The results are converted to UTF8 and
handled just like the rest of the linux/mac version of the code.
This also removes dependencies on std::istream in favour of a
FileInputStream which calls the appropriate unicode version of
open to read a file.
No speed regressions found on Linux or MacOS.
Bug: 62336414
Bug: 63830502
Bug: 65645766
Test: manual
Change-Id: I597da51e33729ed1b98bf246e7e773337fd3fee8
Merged-In: I597da51e33729ed1b98bf246e7e773337fd3fee8
Diffstat (limited to 'tools/aapt2/xml/XmlDom_test.cpp')
-rw-r--r-- | tools/aapt2/xml/XmlDom_test.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/aapt2/xml/XmlDom_test.cpp b/tools/aapt2/xml/XmlDom_test.cpp index f0122e8c617a..1340ada6d953 100644 --- a/tools/aapt2/xml/XmlDom_test.cpp +++ b/tools/aapt2/xml/XmlDom_test.cpp @@ -16,23 +16,20 @@ #include "xml/XmlDom.h" -#include <sstream> #include <string> +#include "io/StringInputStream.h" #include "test/Test.h" +using ::aapt::io::StringInputStream; using ::testing::Eq; using ::testing::NotNull; using ::testing::SizeIs; namespace aapt { -constexpr const char* kXmlPreamble = - "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; - TEST(XmlDomTest, Inflate) { - std::stringstream in(kXmlPreamble); - in << R"( + std::string input = R"(<?xml version="1.0" encoding="utf-8"?> <Layout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> @@ -41,9 +38,9 @@ TEST(XmlDomTest, Inflate) { android:layout_height="wrap_content" /> </Layout>)"; - const Source source("test.xml"); StdErrDiagnostics diag; - std::unique_ptr<xml::XmlResource> doc = xml::Inflate(&in, &diag, source); + StringInputStream in(input); + std::unique_ptr<xml::XmlResource> doc = xml::Inflate(&in, &diag, Source("test.xml")); ASSERT_THAT(doc, NotNull()); xml::Namespace* ns = xml::NodeCast<xml::Namespace>(doc->root.get()); |