diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/libs/dutil/test/DUtilUnitTest/DUtilUnitTest.vcxproj | 3 | ||||
| -rw-r--r-- | src/libs/dutil/test/DUtilUnitTest/LocControlsUtilTests.cpp | 72 | ||||
| -rw-r--r-- | src/libs/dutil/test/DUtilUnitTest/LocStringsUtilTests.cpp (renamed from src/libs/dutil/test/DUtilUnitTest/LocUtilTests.cpp) | 60 |
3 files changed, 75 insertions, 60 deletions
diff --git a/src/libs/dutil/test/DUtilUnitTest/DUtilUnitTest.vcxproj b/src/libs/dutil/test/DUtilUnitTest/DUtilUnitTest.vcxproj index 94826b8f..fccb73c4 100644 --- a/src/libs/dutil/test/DUtilUnitTest/DUtilUnitTest.vcxproj +++ b/src/libs/dutil/test/DUtilUnitTest/DUtilUnitTest.vcxproj | |||
| @@ -55,7 +55,8 @@ | |||
| 55 | <ClCompile Include="FileUtilTest.cpp" /> | 55 | <ClCompile Include="FileUtilTest.cpp" /> |
| 56 | <ClCompile Include="GuidUtilTest.cpp" /> | 56 | <ClCompile Include="GuidUtilTest.cpp" /> |
| 57 | <ClCompile Include="IniUtilTest.cpp" /> | 57 | <ClCompile Include="IniUtilTest.cpp" /> |
| 58 | <ClCompile Include="LocUtilTests.cpp" /> | 58 | <ClCompile Include="LocControlsUtilTests.cpp" /> |
| 59 | <ClCompile Include="LocStringsUtilTests.cpp" /> | ||
| 59 | <ClCompile Include="MemUtilTest.cpp" /> | 60 | <ClCompile Include="MemUtilTest.cpp" /> |
| 60 | <ClCompile Include="MonUtilTest.cpp" /> | 61 | <ClCompile Include="MonUtilTest.cpp" /> |
| 61 | <ClCompile Include="PathUtilTest.cpp" /> | 62 | <ClCompile Include="PathUtilTest.cpp" /> |
diff --git a/src/libs/dutil/test/DUtilUnitTest/LocControlsUtilTests.cpp b/src/libs/dutil/test/DUtilUnitTest/LocControlsUtilTests.cpp new file mode 100644 index 00000000..a558c0c5 --- /dev/null +++ b/src/libs/dutil/test/DUtilUnitTest/LocControlsUtilTests.cpp | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | #include "precomp.h" | ||
| 4 | |||
| 5 | using namespace System; | ||
| 6 | using namespace Xunit; | ||
| 7 | using namespace WixInternal::TestSupport; | ||
| 8 | |||
| 9 | namespace DutilTests | ||
| 10 | { | ||
| 11 | public ref class LocControlsUtil | ||
| 12 | { | ||
| 13 | public: | ||
| 14 | [Fact] | ||
| 15 | void CanLoadControlsWxl() | ||
| 16 | { | ||
| 17 | HRESULT hr = S_OK; | ||
| 18 | WIX_LOCALIZATION* pLoc = NULL; | ||
| 19 | LOC_CONTROL* pLocControl = NULL; | ||
| 20 | |||
| 21 | DutilInitialize(&DutilTestTraceError); | ||
| 22 | |||
| 23 | try | ||
| 24 | { | ||
| 25 | hr = XmlInitialize(); | ||
| 26 | NativeAssert::Succeeded(hr, "Failed to initialize Xml."); | ||
| 27 | |||
| 28 | pin_ptr<const wchar_t> wxlFilePath = PtrToStringChars(TestData::Get("TestData", "LocUtilTests", "controls.wxl")); | ||
| 29 | hr = LocLoadFromFile(wxlFilePath, &pLoc); | ||
| 30 | NativeAssert::Succeeded(hr, "Failed to parse controls.wxl: {0}", wxlFilePath); | ||
| 31 | |||
| 32 | Assert::Equal(3ul, pLoc->cLocControls); | ||
| 33 | |||
| 34 | hr = LocGetControl(pLoc, L"Control1", &pLocControl); | ||
| 35 | NativeAssert::Succeeded(hr, "Failed to get loc control 'Control1' from: {0}", wxlFilePath); | ||
| 36 | NativeAssert::StringEqual(L"Control1", pLocControl->wzControl); | ||
| 37 | NativeAssert::Equal(1, pLocControl->nX); | ||
| 38 | NativeAssert::Equal(2, pLocControl->nY); | ||
| 39 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nWidth); | ||
| 40 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nHeight); | ||
| 41 | NativeAssert::StringEqual(L"This is control #1", pLocControl->wzText); | ||
| 42 | |||
| 43 | hr = LocGetControl(pLoc, L"Control2", &pLocControl); | ||
| 44 | NativeAssert::Succeeded(hr, "Failed to get loc control 'Control2' from: {0}", wxlFilePath); | ||
| 45 | NativeAssert::StringEqual(L"Control2", pLocControl->wzControl); | ||
| 46 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nX); | ||
| 47 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nY); | ||
| 48 | NativeAssert::Equal(50, pLocControl->nWidth); | ||
| 49 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nHeight); | ||
| 50 | NativeAssert::StringEqual(L"This is control #2", pLocControl->wzText); | ||
| 51 | |||
| 52 | hr = LocGetControl(pLoc, L"Control3", &pLocControl); | ||
| 53 | NativeAssert::Succeeded(hr, "Failed to get loc control 'Control3' from: {0}", wxlFilePath); | ||
| 54 | NativeAssert::StringEqual(L"Control3", pLocControl->wzControl); | ||
| 55 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nX); | ||
| 56 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nY); | ||
| 57 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nWidth); | ||
| 58 | NativeAssert::Equal(150, pLocControl->nHeight); | ||
| 59 | NativeAssert::StringEqual(L"", pLocControl->wzText); | ||
| 60 | } | ||
| 61 | finally | ||
| 62 | { | ||
| 63 | if (pLoc) | ||
| 64 | { | ||
| 65 | LocFree(pLoc); | ||
| 66 | } | ||
| 67 | |||
| 68 | DutilUninitialize(); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | }; | ||
| 72 | } | ||
diff --git a/src/libs/dutil/test/DUtilUnitTest/LocUtilTests.cpp b/src/libs/dutil/test/DUtilUnitTest/LocStringsUtilTests.cpp index 0376a340..1bfc4bb4 100644 --- a/src/libs/dutil/test/DUtilUnitTest/LocUtilTests.cpp +++ b/src/libs/dutil/test/DUtilUnitTest/LocStringsUtilTests.cpp | |||
| @@ -8,7 +8,7 @@ using namespace WixInternal::TestSupport; | |||
| 8 | 8 | ||
| 9 | namespace DutilTests | 9 | namespace DutilTests |
| 10 | { | 10 | { |
| 11 | public ref class LocUtil | 11 | public ref class LocStringsUtil |
| 12 | { | 12 | { |
| 13 | public: | 13 | public: |
| 14 | [Fact] | 14 | [Fact] |
| @@ -89,63 +89,5 @@ namespace DutilTests | |||
| 89 | DutilUninitialize(); | 89 | DutilUninitialize(); |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
| 92 | |||
| 93 | [Fact] | ||
| 94 | void CanLoadControlsWxl() | ||
| 95 | { | ||
| 96 | HRESULT hr = S_OK; | ||
| 97 | WIX_LOCALIZATION* pLoc = NULL; | ||
| 98 | LOC_CONTROL* pLocControl = NULL; | ||
| 99 | |||
| 100 | DutilInitialize(&DutilTestTraceError); | ||
| 101 | |||
| 102 | try | ||
| 103 | { | ||
| 104 | hr = XmlInitialize(); | ||
| 105 | NativeAssert::Succeeded(hr, "Failed to initialize Xml."); | ||
| 106 | |||
| 107 | pin_ptr<const wchar_t> wxlFilePath = PtrToStringChars(TestData::Get("TestData", "LocUtilTests", "controls.wxl")); | ||
| 108 | hr = LocLoadFromFile(wxlFilePath, &pLoc); | ||
| 109 | NativeAssert::Succeeded(hr, "Failed to parse controls.wxl: {0}", wxlFilePath); | ||
| 110 | |||
| 111 | Assert::Equal(3ul, pLoc->cLocControls); | ||
| 112 | |||
| 113 | hr = LocGetControl(pLoc, L"Control1", &pLocControl); | ||
| 114 | NativeAssert::Succeeded(hr, "Failed to get loc control 'Control1' from: {0}", wxlFilePath); | ||
| 115 | NativeAssert::StringEqual(L"Control1", pLocControl->wzControl); | ||
| 116 | NativeAssert::Equal(1, pLocControl->nX); | ||
| 117 | NativeAssert::Equal(2, pLocControl->nY); | ||
| 118 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nWidth); | ||
| 119 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nHeight); | ||
| 120 | NativeAssert::StringEqual(L"This is control #1", pLocControl->wzText); | ||
| 121 | |||
| 122 | hr = LocGetControl(pLoc, L"Control2", &pLocControl); | ||
| 123 | NativeAssert::Succeeded(hr, "Failed to get loc control 'Control2' from: {0}", wxlFilePath); | ||
| 124 | NativeAssert::StringEqual(L"Control2", pLocControl->wzControl); | ||
| 125 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nX); | ||
| 126 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nY); | ||
| 127 | NativeAssert::Equal(50, pLocControl->nWidth); | ||
| 128 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nHeight); | ||
| 129 | NativeAssert::StringEqual(L"This is control #2", pLocControl->wzText); | ||
| 130 | |||
| 131 | hr = LocGetControl(pLoc, L"Control3", &pLocControl); | ||
| 132 | NativeAssert::Succeeded(hr, "Failed to get loc control 'Control3' from: {0}", wxlFilePath); | ||
| 133 | NativeAssert::StringEqual(L"Control3", pLocControl->wzControl); | ||
| 134 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nX); | ||
| 135 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nY); | ||
| 136 | NativeAssert::Equal(LOC_CONTROL_NOT_SET, pLocControl->nWidth); | ||
| 137 | NativeAssert::Equal(150, pLocControl->nHeight); | ||
| 138 | NativeAssert::StringEqual(L"", pLocControl->wzText); | ||
| 139 | } | ||
| 140 | finally | ||
| 141 | { | ||
| 142 | if (pLoc) | ||
| 143 | { | ||
| 144 | LocFree(pLoc); | ||
| 145 | } | ||
| 146 | |||
| 147 | DutilUninitialize(); | ||
| 148 | } | ||
| 149 | } | ||
| 150 | }; | 92 | }; |
| 151 | } | 93 | } |
