Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce usage of Json::Value throughout Terminal.Settings.Model #11184

Merged
30 commits merged into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
20b91fb
Reduce usage of Json::Value throughout Terminal.Settings.Model
lhecker Sep 9, 2021
64896e5
Fix most unit tests
lhecker Sep 9, 2021
1efe485
Fix several issues
lhecker Sep 9, 2021
cdf07bb
Address Dustin's comments
lhecker Sep 10, 2021
2247297
Address Carlos' comments
lhecker Sep 10, 2021
451d7d5
Bug fixes sponsored by Dustin-chan
lhecker Sep 13, 2021
55fb5f3
Address Carlos' comments & Add code comments
lhecker Sep 14, 2021
35b65e6
Fix typo
lhecker Sep 14, 2021
f1b20cf
Allow return value optimizations
lhecker Sep 14, 2021
e2b6e64
Merge branch 'main' into dev/lhecker/settings-json-cleanup
lhecker Sep 14, 2021
670039f
Address various feedback
lhecker Sep 15, 2021
a26cfe3
Fixup for the previous commit
lhecker Sep 15, 2021
8c6edc5
Address Dustin's comments
lhecker Sep 15, 2021
e58b5bd
Address Dustin's comments
lhecker Sep 15, 2021
101254f
Make filter generic over future OriginTags
lhecker Sep 15, 2021
06bfbd7
Restore starting directory
lhecker Sep 15, 2021
f0887b9
Merge remote-tracking branch 'origin/main' into dev/lhecker/settings-…
lhecker Sep 15, 2021
4713e8c
Fix VS generator compilation + Fix clang-tidy warnings
lhecker Sep 15, 2021
8f669c6
Merge remote-tracking branch 'origin/main' into dev/lhecker/settings-…
lhecker Sep 16, 2021
9c59a20
Fix VS generator not producing a source
lhecker Sep 17, 2021
76b78dc
Fix spell check issues
lhecker Sep 17, 2021
239d2ef
Un-template executeGenerator
lhecker Sep 17, 2021
57c8991
Slightly restructure SettingsLoader order
lhecker Sep 17, 2021
7bcbd98
Improve clarity around _userProfileCount
lhecker Sep 17, 2021
4a75631
Remove useless UTF-8 BOM
lhecker Sep 17, 2021
c4dfb78
Address Carlos' comments
lhecker Sep 20, 2021
1aae0ef
Merge remote-tracking branch 'origin/main' into dev/lhecker/settings-…
lhecker Sep 20, 2021
fa9d0d5
Address Mike's comments
lhecker Sep 22, 2021
2f3d43a
German ain't English
lhecker Sep 22, 2021
55c62b4
Restore Resources.resw
lhecker Sep 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/spelling/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ DECSTR
DECSWL
DECTCEM
Dedupe
deduplicate
deduplicated
DEFAPP
DEFAULTBACKGROUND
Expand Down Expand Up @@ -784,6 +785,7 @@ FINDSTRINGEXACT
FINDUP
FIter
FIXEDCONVERTED
FIXEDFILEINFO
Flg
flyout
fmodern
Expand Down Expand Up @@ -1992,6 +1994,7 @@ resx
retval
rfa
rfc
rfid
rftp
rgb
rgba
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ If you would like to ask a question that you feel doesn't warrant an issue
* You must [enable Developer Mode in the Windows Settings
app](https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development)
to locally install and run Windows Terminal
* You must have [PowerShell 7 or later](https://github.com/PowerShell/PowerShell/releases/latest) installed
lhecker marked this conversation as resolved.
Show resolved Hide resolved
* You must have the [Windows 10 1903
SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk)
installed
Expand Down
532 changes: 244 additions & 288 deletions src/cascadia/LocalTests_SettingsModel/ColorSchemeTests.cpp

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions src/cascadia/LocalTests_SettingsModel/CommandTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ namespace SettingsModelLocalTests
TEST_METHOD(TestLayerOnAutogeneratedName);

TEST_METHOD(TestGenerateCommandline);

TEST_CLASS_SETUP(ClassSetup)
{
InitializeJsonReader();
return true;
}
};

void CommandTests::ManyCommandsSameAction()
Expand Down
1,821 changes: 441 additions & 1,380 deletions src/cascadia/LocalTests_SettingsModel/DeserializationTests.cpp

Large diffs are not rendered by default.

30 changes: 10 additions & 20 deletions src/cascadia/LocalTests_SettingsModel/JsonTestClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,34 @@ Module Name:

Abstract:
- This class is a helper that can be used to quickly create tests that need to
read & parse json data. Test classes that need to read JSON should make sure
to derive from this class, and also make sure to call InitializeJsonReader()
in the TEST_CLASS_SETUP().
read & parse json data.

Author(s):
Mike Griese (migrie) August-2019
--*/

#pragma once

class JsonTestClass
{
public:
void InitializeJsonReader()
{
_reader = std::unique_ptr<Json::CharReader>(Json::CharReaderBuilder::CharReaderBuilder().newCharReader());
};

void InitializeJsonWriter()
static Json::Value VerifyParseSucceeded(const std::string_view& content)
{
_writer = std::unique_ptr<Json::StreamWriter>(Json::StreamWriterBuilder::StreamWriterBuilder().newStreamWriter());
}
static const std::unique_ptr<Json::CharReader> reader{ Json::CharReaderBuilder::CharReaderBuilder().newCharReader() };

Json::Value VerifyParseSucceeded(std::string content)
{
Json::Value root;
std::string errs;
const bool parseResult = _reader->parse(content.c_str(), content.c_str() + content.size(), &root, &errs);
const bool parseResult = reader->parse(content.data(), content.data() + content.size(), &root, &errs);
VERIFY_IS_TRUE(parseResult, winrt::to_hstring(errs).c_str());
return root;
};

std::string toString(const Json::Value& json)
static std::string toString(const Json::Value& json)
{
static const std::unique_ptr<Json::StreamWriter> writer{ Json::StreamWriterBuilder::StreamWriterBuilder().newStreamWriter() };

std::stringstream s;
_writer->write(json, &s);
writer->write(json, &s);
return s.str();
}

protected:
std::unique_ptr<Json::CharReader> _reader;
std::unique_ptr<Json::StreamWriter> _writer;
};
6 changes: 0 additions & 6 deletions src/cascadia/LocalTests_SettingsModel/KeyBindingsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ namespace SettingsModelLocalTests

TEST_METHOD(TestGetKeyBindingForAction);
TEST_METHOD(KeybindingsWithoutVkey);

TEST_CLASS_SETUP(ClassSetup)
{
InitializeJsonReader();
return true;
}
};

void KeyBindingsTests::KeyChords()
Expand Down
Loading