Skip to content

Commit

Permalink
Make GlobalAppSettings a WinRT object
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-zamora committed Aug 24, 2020
1 parent 6b24b4c commit f4b187b
Show file tree
Hide file tree
Showing 19 changed files with 322 additions and 247 deletions.
46 changes: 23 additions & 23 deletions src/cascadia/LocalTests_TerminalApp/ColorSchemeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,23 @@ namespace TerminalAppLocalTests

CascadiaSettings settings;

VERIFY_ARE_EQUAL(0u, settings._globals.GetColorSchemes().size());
VERIFY_ARE_EQUAL(0u, settings._globals.GetColorSchemes().Size());
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme0Json));
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme1Json));
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme2Json));
VERIFY_IS_NULL(settings._FindMatchingColorScheme(scheme3Json));

settings._LayerOrCreateColorScheme(scheme0Json);
{
for (auto& kv : settings._globals._colorSchemes)
for (auto kv : settings._globals.GetColorSchemes())
{
Log::Comment(NoThrowString().Format(
L"kv:%s->%s", kv.first.data(), kv.second.Name().data()));
L"kv:%s->%s", kv.Key().data(), kv.Value().Name().data()));
}
VERIFY_ARE_EQUAL(1u, settings._globals.GetColorSchemes().size());
VERIFY_ARE_EQUAL(1u, settings._globals.GetColorSchemes().Size());

VERIFY_IS_TRUE(settings._globals._colorSchemes.find(L"scheme0") != settings._globals._colorSchemes.end());
auto scheme0Proj = settings._globals._colorSchemes.find(L"scheme0")->second;
VERIFY_IS_TRUE(settings._globals.GetColorSchemes().HasKey(L"scheme0"));
auto scheme0Proj = settings._globals.GetColorSchemes().Lookup(L"scheme0");
auto scheme0 = winrt::get_self<ColorScheme>(scheme0Proj);

VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme0Json));
Expand All @@ -225,13 +225,13 @@ namespace TerminalAppLocalTests
settings._LayerOrCreateColorScheme(scheme1Json);

{
VERIFY_ARE_EQUAL(2u, settings._globals.GetColorSchemes().size());
VERIFY_ARE_EQUAL(2u, settings._globals.GetColorSchemes().Size());

VERIFY_IS_TRUE(settings._globals._colorSchemes.find(L"scheme0") != settings._globals._colorSchemes.end());
auto scheme0Proj = settings._globals._colorSchemes.find(L"scheme0")->second;
VERIFY_IS_TRUE(settings._globals.GetColorSchemes().HasKey(L"scheme0"));
auto scheme0Proj = settings._globals.GetColorSchemes().Lookup(L"scheme0");
auto scheme0 = winrt::get_self<ColorScheme>(scheme0Proj);
VERIFY_IS_TRUE(settings._globals._colorSchemes.find(L"scheme1") != settings._globals._colorSchemes.end());
auto scheme1Proj = settings._globals._colorSchemes.find(L"scheme1")->second;
VERIFY_IS_TRUE(settings._globals.GetColorSchemes().HasKey(L"scheme1"));
auto scheme1Proj = settings._globals.GetColorSchemes().Lookup(L"scheme1");
auto scheme1 = winrt::get_self<ColorScheme>(scheme1Proj);

VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme0Json));
Expand All @@ -246,13 +246,13 @@ namespace TerminalAppLocalTests
settings._LayerOrCreateColorScheme(scheme2Json);

{
VERIFY_ARE_EQUAL(2u, settings._globals.GetColorSchemes().size());
VERIFY_ARE_EQUAL(2u, settings._globals.GetColorSchemes().Size());

VERIFY_IS_TRUE(settings._globals._colorSchemes.find(L"scheme0") != settings._globals._colorSchemes.end());
auto scheme0Proj = settings._globals._colorSchemes.find(L"scheme0")->second;
VERIFY_IS_TRUE(settings._globals.GetColorSchemes().HasKey(L"scheme0"));
auto scheme0Proj = settings._globals.GetColorSchemes().Lookup(L"scheme0");
auto scheme0 = winrt::get_self<ColorScheme>(scheme0Proj);
VERIFY_IS_TRUE(settings._globals._colorSchemes.find(L"scheme1") != settings._globals._colorSchemes.end());
auto scheme1Proj = settings._globals._colorSchemes.find(L"scheme1")->second;
VERIFY_IS_TRUE(settings._globals.GetColorSchemes().HasKey(L"scheme1"));
auto scheme1Proj = settings._globals.GetColorSchemes().Lookup(L"scheme1");
auto scheme1 = winrt::get_self<ColorScheme>(scheme1Proj);

VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme0Json));
Expand All @@ -267,16 +267,16 @@ namespace TerminalAppLocalTests
settings._LayerOrCreateColorScheme(scheme3Json);

{
VERIFY_ARE_EQUAL(3u, settings._globals.GetColorSchemes().size());
VERIFY_ARE_EQUAL(3u, settings._globals.GetColorSchemes().Size());

VERIFY_IS_TRUE(settings._globals._colorSchemes.find(L"scheme0") != settings._globals._colorSchemes.end());
auto scheme0Proj = settings._globals._colorSchemes.find(L"scheme0")->second;
VERIFY_IS_TRUE(settings._globals.GetColorSchemes().HasKey(L"scheme0"));
auto scheme0Proj = settings._globals.GetColorSchemes().Lookup(L"scheme0");
auto scheme0 = winrt::get_self<ColorScheme>(scheme0Proj);
VERIFY_IS_TRUE(settings._globals._colorSchemes.find(L"scheme1") != settings._globals._colorSchemes.end());
auto scheme1Proj = settings._globals._colorSchemes.find(L"scheme1")->second;
VERIFY_IS_TRUE(settings._globals.GetColorSchemes().HasKey(L"scheme1"));
auto scheme1Proj = settings._globals.GetColorSchemes().Lookup(L"scheme1");
auto scheme1 = winrt::get_self<ColorScheme>(scheme1Proj);
VERIFY_IS_TRUE(settings._globals._colorSchemes.find(L"") != settings._globals._colorSchemes.end());
auto scheme2Proj = settings._globals._colorSchemes.find(L"")->second;
VERIFY_IS_TRUE(settings._globals.GetColorSchemes().HasKey(L""));
auto scheme2Proj = settings._globals.GetColorSchemes().Lookup(L"");
auto scheme2 = winrt::get_self<ColorScheme>(scheme2Proj);

VERIFY_IS_NOT_NULL(settings._FindMatchingColorScheme(scheme0Json));
Expand Down
Loading

0 comments on commit f4b187b

Please sign in to comment.