aboutsummaryrefslogtreecommitdiff
path: root/src/libs/dutil/test/DUtilUnitTest/LocStringsUtilTests.cpp
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2025-03-18 17:12:42 -0700
committerRob Mensching <rob@firegiant.com>2025-03-18 18:01:57 -0700
commit32bfb97857041bb4385df3754c3f9eb2f8b23d8e (patch)
treef26125a61c3bda97d6f3031c17cb262e404acd0b /src/libs/dutil/test/DUtilUnitTest/LocStringsUtilTests.cpp
parent7133077ecc0ef2ada3746c8a0569b1028b6ff6d1 (diff)
downloadwix-32bfb97857041bb4385df3754c3f9eb2f8b23d8e.tar.gz
wix-32bfb97857041bb4385df3754c3f9eb2f8b23d8e.tar.bz2
wix-32bfb97857041bb4385df3754c3f9eb2f8b23d8e.zip
LocUtil occasionally failed due to XmlInitialization
Split into separate classes to prevent potential parallelism race conditions.
Diffstat (limited to '')
-rw-r--r--src/libs/dutil/test/DUtilUnitTest/LocStringsUtilTests.cpp (renamed from src/libs/dutil/test/DUtilUnitTest/LocUtilTests.cpp)60
1 files changed, 1 insertions, 59 deletions
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
9namespace DutilTests 9namespace 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}