MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / TEST_F

Function TEST_F

test/ColourSchemes.cpp:119–151  ·  view source on GitHub ↗

With an empty settings folder, the default schemes should be loaded

Source from the content-addressed store, hash-verified

117
118// With an empty settings folder, the default schemes should be loaded
119TEST_F(ColourSchemeTestWithEmptySettings, LoadDefaultSchemes)
120{
121 auto defaultSchemeNames = {
122 SCHEME_DARKRADIANT_DEFAULT,
123 SCHEME_QE3,
124 SCHEME_BLACK_AND_GREEN,
125 SCHEME_MAYA_MAX,
126 SCHEME_SUPER_MAL
127 };
128
129 // Check the default colours.xml file
130 std::string defaultColoursFile = _context.getRuntimeDataPath() + "colours.xml";
131 EXPECT_TRUE(fs::exists(defaultColoursFile)) << "Could not find factory colours file: " << defaultColoursFile;
132
133 for (auto name : defaultSchemeNames)
134 {
135 EXPECT_TRUE(GlobalColourSchemeManager().schemeExists(name)) << "Scheme " << name << " not found";
136
137 auto defaultScheme = loadSchemeFromXml(name, defaultColoursFile);
138 auto& loadedScheme = GlobalColourSchemeManager().getColourScheme(name);
139
140 // Number of items must match
141 EXPECT_EQ(defaultScheme.size(), getItemCountInScheme(loadedScheme));
142
143 // Each item must match
144 for (const auto& defaultColour : defaultScheme)
145 {
146 EXPECT_EQ(loadedScheme.getColour(defaultColour.first).getColour(), defaultColour.second)
147 << "Scheme " << name << ": colour " << defaultColour.first
148 << " doesn't match the default value " << defaultColour.second;
149 }
150 }
151}
152
153TEST_F(ColourSchemeTestWithEmptySettings, DefaultSchemeIsActive)
154{

Callers

nothing calls this directly

Calls 15

loadSchemeFromXmlFunction · 0.85
getItemCountInSchemeFunction · 0.85
modifySchemeColourFunction · 0.85
countFunction · 0.85
schemeExistsMethod · 0.80
getActiveSchemeMethod · 0.80
saveColourSchemesMethod · 0.80
saveToDiskMethod · 0.80
stringMethod · 0.80
restoreColourSchemesMethod · 0.80
foreachSchemeMethod · 0.80
getRuntimeDataPathMethod · 0.45

Tested by

no test coverage detected