MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / SetUp

Method SetUp

tests/src/Mod/Material/App/TestMaterialFilter.cpp:49–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 void SetUp() override {
50 _modelManager = &(Materials::ModelManager::getManager());
51 _materialManager = &(Materials::MaterialManager::getManager());
52
53 // Use our test files as a custom directory
54 ParameterGrp::handle hGrp =
55 App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Material/Resources");
56
57 _customDir = hGrp->GetASCII("CustomMaterialsDir", "");
58 _useBuiltInDir = hGrp->GetBool("UseBuiltInMaterials", true);
59 _useWorkbenchDir = hGrp->GetBool("UseMaterialsFromWorkbenches", true);
60 _useUserDir = hGrp->GetBool("UseMaterialsFromConfigDir", true);
61 _useCustomDir = hGrp->GetBool("UseMaterialsFromCustomDir", false);
62
63 std::string testPath = App::Application::getHomePath() + "/tests/Materials/";
64 hGrp->SetASCII("CustomMaterialsDir", testPath);
65 hGrp->SetBool("UseBuiltInMaterials", false);
66 hGrp->SetBool("UseMaterialsFromWorkbenches", false);
67 hGrp->SetBool("UseMaterialsFromConfigDir", false);
68 hGrp->SetBool("UseMaterialsFromCustomDir", true);
69
70 auto param = App::GetApplication().GetParameterGroupByPath(
71 "User parameter:BaseApp/Preferences/Mod/Material/Editor");
72 param->SetBool("ShowFavorites", true);
73 param->SetBool("ShowRecent", true);
74 param->SetBool("ShowEmptyFolders", false);
75 param->SetBool("ShowEmptyLibraries", true);
76 param->SetBool("ShowLegacy", false);
77
78 _materialManager->refresh();
79
80 _library = _materialManager->getLibrary(QStringLiteral("Custom"));
81 }
82
83 void TearDown() override {
84 ParameterGrp::handle hGrp =

Callers

nothing calls this directly

Calls 7

GetASCIIMethod · 0.80
GetBoolMethod · 0.80
SetASCIIMethod · 0.80
SetBoolMethod · 0.80
refreshMethod · 0.45
getLibraryMethod · 0.45

Tested by

no test coverage detected