@@ -61,7 +61,6 @@ namespace SettingsModelLocalTests
6161
6262 void SerializationTests::GlobalSettings ()
6363 {
64- DebugBreak ();
6564 // This needs to be in alphabetical order.
6665 const std::string globalsString{
6766 " {"
@@ -70,7 +69,6 @@ namespace SettingsModelLocalTests
7069 " \" confirmCloseAllTabs\" : true,"
7170 " \" copyFormatting\" : \" all\" ,"
7271 " \" copyOnSelect\" : false,"
73- " \" debugFeatures\" : true,"
7472 " \" defaultProfile\" : \" {61c54bbd-c2c6-5271-96e7-009a87ff44bf}\" ,"
7573 " \" experimental.input.forceVT\" : false,"
7674 " \" experimental.rendering.forceFullRepaint\" : false,"
@@ -113,42 +111,41 @@ namespace SettingsModelLocalTests
113111
114112 void SerializationTests::Profile ()
115113 {
116- DebugBreak ();
114+ // This needs to be in alphabetical order.
117115 const std::string profileString{
118116 " {"
119- " \" name\" : \" Windows PowerShell\" ,"
120- " \" guid\" : \" {61c54bbd-c2c6-5271-96e7-009a87ff44bf}\" ,"
121- " \" hidden\" : false,"
122- " \" foreground\" : \" #AABBCC\" ,"
117+ " \" altGrAliasing\" : true,"
118+ " \" antialiasingMode\" : \" grayscale\" ,"
123119 " \" background\" : \" #BBCCAA\" ,"
124- " \" selectionBackground\" : \" #CCAABB\" ,"
125- " \" cursorColor\" : \" #CCBBAA\" ,"
120+ " \" backgroundImage\" : \" made_you_look.jpeg\" ,"
121+ " \" backgroundImageAlignment\" : \" center\" ,"
122+ " \" backgroundImageOpacity\" : 1.0,"
123+ " \" backgroundImageStretchMode\" : \" uniformToFill\" ,"
124+ " \" closeOnExit\" : \" graceful\" ,"
126125 " \" colorScheme\" : \" Campbell\" ,"
127- " \" historySize\" : 9001,"
128- " \" snapOnInput\" : true,"
129- " \" altGrAliasing\" : true,"
130- " \" cursorHeight\" : null,"
126+ " \" commandline\" : \" %SystemRoot%\\\\ System32\\\\ WindowsPowerShell\\\\ v1.0\\\\ powershell.exe\" ,"
127+ " \" cursorColor\" : \" #CCBBAA\" ,"
128+ " \" cursorHeight\" : 10,"
131129 " \" cursorShape\" : \" bar\" ,"
132- " \" tabTitle\" : null,"
133- " \" fontWeight\" : \" normal\" ,"
134- // "\"connectionType\": null,"
135- " \" commandline\" : \" %SystemRoot%\\ System32\\ WindowsPowerShell\\ v1.0\\ powershell.exe\" ,"
130+ " \" experimental.retroTerminalEffect\" : false,"
136131 " \" fontFace\" : \" Cascadia Mono\" ,"
137132 " \" fontSize\" : 12,"
138- " \" useAcrylic\" : false,"
139- " \" suppressApplicationTitle\" : false,"
140- " \" closeOnExit\" : \" graceful\" ,"
133+ " \" fontWeight\" : \" normal\" ,"
134+ " \" foreground\" : \" #AABBCC\" ,"
135+ " \" guid\" : \" {61c54bbd-c2c6-5271-96e7-009a87ff44bf}\" ,"
136+ " \" hidden\" : false,"
137+ " \" historySize\" : 9001,"
138+ " \" icon\" : \" ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png\" ,"
139+ " \" name\" : \" Windows PowerShell\" ,"
141140 " \" padding\" : \" 8, 8, 8, 8\" ,"
142141 " \" scrollbarState\" : \" visible\" ,"
142+ " \" selectionBackground\" : \" #CCAABB\" ,"
143+ " \" snapOnInput\" : true,"
143144 " \" startingDirectory\" : \" %USERPROFILE%\" ,"
144- " \" icon\" : \" ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png\" ,"
145- " \" backgroundImage\" : null,"
146- " \" backgroundImageOpacity\" : 1.0,"
147- " \" backgroundImageStretchMode\" : \" uniformToFill\" ,"
148- " \" backgroundImageAlignment\" : \" center\" ,"
149- " \" experimental.retroTerminalEffect\" : false,"
150- " \" antialiasingMode\" : \" grayscale\" "
145+ " \" suppressApplicationTitle\" : false,"
151146 " \" tabColor\" : \" #0C0C0C\" ,"
147+ " \" tabTitle\" : \" Cool Tab\" ,"
148+ " \" useAcrylic\" : false"
152149 " }"
153150 };
154151
@@ -160,9 +157,9 @@ namespace SettingsModelLocalTests
160157
161158 auto roundtripTest = [this ](auto jsonString) {
162159 const auto json{ VerifyParseSucceeded (jsonString) };
163- const auto globals { implementation::Profile::FromJson (json) };
160+ const auto profile { implementation::Profile::FromJson (json) };
164161
165- const auto result{ globals ->ToJson () };
162+ const auto result{ profile ->ToJson () };
166163
167164 VERIFY_ARE_EQUAL (jsonString, toString (result));
168165 };
@@ -173,47 +170,112 @@ namespace SettingsModelLocalTests
173170
174171 void SerializationTests::ColorScheme ()
175172 {
176- DebugBreak ();
173+ // This needs to be in alphabetical order.
177174 const std::string schemeString{ " {"
178- " \" name \" : \" Campbell \" ,"
179- " \" foreground \" : \" #F2F2F2 \" ,"
180- " \" background \" : \" #0C0C0C \" ,"
181- " \" selectionBackground \" : \" #131313 \" ,"
182- " \" cursorColor \" : \" #FFFFFF \" ,"
183- " \" black \" : \" #0C0C0C \" ,"
184- " \" red \" : \" #C50F1F \" ,"
185- " \" green \" : \" #13A10E \" ,"
186- " \" yellow \" : \" #C19C00 \" "
187- " \" blue \" : \" #0037DA \" ,"
188- " \" purple \" : \" #881798 \" ,"
189- " \" cyan \" : \" #3A96DD \" ,"
190- " \" white \" : \" #CCCCCC \" ,"
191- " \" brightBlack \" : \" #767676 \" ,"
192- " \" brightRed \" : \" #E74856 \" ,"
193- " \" brightGreen \" : \" #16C60C \" ,"
194- " \" brightYellow \" : \" #F9F1A5 \" ,"
195- " \" brightBlue \" : \" #3B78FF \" ,"
196- " \" brightPurple \" : \" #B4009E \" ,"
197- " \" brightCyan \" : \" #61D6D6 \" ,"
198- " \" brightWhite \" : \" #F2F2F2 \" "
175+ " \" background \" : \" #0C0C0C \" ,"
176+ " \" black \" : \" #0C0C0C \" ,"
177+ " \" blue \" : \" #0037DA \" ,"
178+ " \" brightBlack \" : \" #767676 \" ,"
179+ " \" brightBlue \" : \" #3B78FF \" ,"
180+ " \" brightCyan \" : \" #61D6D6 \" ,"
181+ " \" brightGreen \" : \" #16C60C \" ,"
182+ " \" brightPurple \" : \" #B4009E \" ,"
183+ " \" brightRed \" : \" #E74856 \" , "
184+ " \" brightWhite \" : \" #F2F2F2 \" ,"
185+ " \" brightYellow \" : \" #F9F1A5 \" ,"
186+ " \" cursorColor \" : \" #FFFFFF \" ,"
187+ " \" cyan \" : \" #3A96DD \" ,"
188+ " \" foreground \" : \" #F2F2F2 \" ,"
189+ " \" green \" : \" #13A10E \" ,"
190+ " \" name \" : \" Campbell \" ,"
191+ " \" purple \" : \" #881798 \" ,"
192+ " \" red \" : \" #C50F1F \" ,"
193+ " \" selectionBackground \" : \" #131313 \" ,"
194+ " \" white \" : \" #CCCCCC \" ,"
195+ " \" yellow \" : \" #C19C00 \" "
199196 " }" };
200197
201198 const auto json{ VerifyParseSucceeded (schemeString) };
202- const auto profile { implementation::ColorScheme::FromJson (json) };
199+ const auto scheme { implementation::ColorScheme::FromJson (json) };
203200
204- const auto result{ profile ->ToJson () };
205- VERIFY_ARE_EQUAL (json, result);
201+ const auto result{ scheme ->ToJson () };
202+ VERIFY_ARE_EQUAL (schemeString, toString ( result) );
206203 }
207204
208205 void SerializationTests::CascadiaSettings ()
209206 {
210207 DebugBreak ();
211- const std::string settingsString{ " " };
208+ // clang-format off
209+ // This needs to be in alphabetical order.
210+ const std::string settingsString{ " {"
211+ " \" $schema\" : \" https://aka.ms/terminal-profiles-schema\" ,"
212+ " \" actions\" : ["
213+ " {\" command\" : {\" action\" : \" renameTab\" ,\" input\" : \" Liang Tab\" },\" keys\" : \" ctrl+t\" }"
214+ " ],"
215+ " \" defaultProfile\" : \" {61c54bbd-1111-5271-96e7-009a87ff44bf}\" ,"
216+ " \" keybindings\" : ["
217+ " {\" command\" : {\" action\" : \" sendInput\" ,\" input\" : \" VT Griese Mode\" },\" keys\" : \" ctrl+k\" }"
218+ " ],"
219+ " \" profiles\" : {"
220+ " \" defaults\" : {"
221+ " \" fontFace\" : \" Zamora Code\" "
222+ " },"
223+ " \" list\" : ["
224+ " {"
225+ " \" fontFace\" : \" Cascadia Code\" ,"
226+ " \" guid\" : \" {61c54bbd-1111-5271-96e7-009a87ff44bf}\" ,"
227+ " \" name\" : \" HowettShell\" "
228+ " },"
229+ " {"
230+ " \" antialiasingMode\" : \" aliased\" ,"
231+ " \" name\" : \" NiksaShell\" "
232+ " },"
233+ " {"
234+ " \" name\" : \" BhojwaniShell\" ,"
235+ " \" source\" : \" local\" "
236+ " }"
237+ " ]"
238+ " },"
239+ " \" schemes\" : ["
240+ " {"
241+ " \" background\" : \" #3C0315\" ,"
242+ " \" black\" : \" #282A2E\" ,"
243+ " \" blue\" : \" #0170C5\" ,"
244+ " \" brightBlack\" : \" #676E7A\" ,"
245+ " \" brightBlue\" : \" #5C98C5\" ,"
246+ " \" brightCyan\" : \" #8ABEB7\" ,"
247+ " \" brightGreen\" : \" #B5D680\" ,"
248+ " \" brightPurple\" : \" #AC79BB\" ,"
249+ " \" brightRed\" : \" #BD6D85\" ,"
250+ " \" brightWhite\" : \" #FFFFFD\" ,"
251+ " \" brightYellow\" : \" #FFFD76\" ,"
252+ " \" cursorColor\" : \" #FFFFFD\" ,"
253+ " \" cyan\" : \" #3F8D83\" ,"
254+ " \" foreground\" : \" #FFFFFD\" ,"
255+ " \" green\" : \" #76AB23\" ,"
256+ " \" name\" : \" Cinnamon Roll\" ,"
257+ " \" purple\" : \" #7D498F\" ,"
258+ " \" red\" : \" #BD0940\" ,"
259+ " \" selectionBackground\" : \" #FFFFFF\" ,"
260+ " \" white\" : \" #FFFFFD\" ,"
261+ " \" yellow\" : \" #E0DE48\" "
262+ " }"
263+ " ]"
264+ " }" };
265+ // clang-format on
212266
213- const auto json{ VerifyParseSucceeded (settingsString) };
214- const auto settings{ implementation::CascadiaSettings::FromJson (json) };
267+ auto settings{ winrt::make_self<implementation::CascadiaSettings>(false ) };
268+ settings->_ParseJsonString (settingsString, false );
269+ settings->_ApplyDefaultsFromUserSettings ();
270+ settings->LayerJson (settings->_userSettings );
271+ settings->_ValidateSettings ();
215272
273+ // TODO CARLOS:
274+ // - temp/DebugBreak is only for testing. Remove after we're done here.
275+ // - NiksaShell prints out a guid, when it shouldn't be
276+ // - BhojwaniShell is missing entirely
216277 const auto result{ settings->ToJson () };
217- VERIFY_ARE_EQUAL (json, result);
278+ const auto temp{ toString (result) };
279+ VERIFY_ARE_EQUAL (settingsString, toString (result));
218280 }
219281}
0 commit comments