-// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
InitializationPlugin_Plugin::InitializationPlugin_Plugin()
{
+ char* isUnitTest = getenv("SHAPER_UNIT_TEST_IN_PROGRESS");
+ myInitDataModel = (!isUnitTest || isUnitTest[0] != '1');
+
Events_Loop* aLoop = Events_Loop::loop();
const Events_ID kDocCreatedEvent = ModelAPI_DocumentCreatedMessage::eventId();
aLoop->registerListener(this, kDocCreatedEvent, NULL, true);
if (aDoc != ModelAPI_Session::get()->moduleDocument())
return;
- myEvalListener->initDataModel();
+ if (myInitDataModel)
+ myEvalListener->initDataModel();
std::list<FeaturePtr> aFeatures;
new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)));
Events_Loop::loop()->send(aMsg);
- FeaturePtr aOrigin = createPoint(aDoc, "Origin", 0., 0., 0.);
+ FeaturePtr aOrigin = createPoint(aDoc, L"Origin", 0., 0., 0.);
aFeatures.push_back(aOrigin);
aFeatures.push_back(createAxis(aDoc, aOrigin, 100., 0., 0.));
aFeatures.push_back(createAxis(aDoc, aOrigin, 0., 100., 0.));
aPlane->real("D")->setValue(0.);
if (theX) {
- aPlane->data()->setName("YOZ");
+ aPlane->data()->setName(L"YOZ");
} else if (theY) {
- aPlane->data()->setName("XOZ");
+ aPlane->data()->setName(L"XOZ");
} else if (theZ) {
- aPlane->data()->setName("XOY");
+ aPlane->data()->setName(L"XOY");
}
// don't show automatically created feature in the features history
aPlane->setInHistory(aPlane, false);
return aPlane;
}
-FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const std::string& theName,
+FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const std::wstring& theName,
double theX, double theY, double theZ)
{
std::shared_ptr<ModelAPI_Feature> aPoint = theDoc->addFeature("Point");
aAxis->real("Z_Direction")->setValue(theZ);
if (theX != 0) {
- aAxis->data()->setName("OX");
+ aAxis->data()->setName(L"OX");
} else if (theY != 0) {
- aAxis->data()->setName("OY");
+ aAxis->data()->setName(L"OY");
} else if (theZ != 0) {
- aAxis->data()->setName("OZ");
+ aAxis->data()->setName(L"OZ");
}
// don't show automatically created feature in the features history
aAxis->setInHistory(aAxis, false);