aFeature.execute()
aSession.finishOperation()
-aFeature1 = aDoc.object("Construction", 0)
+# with index "0" is Origin and then - all default constructions
+aFeature1 = aDoc.object("Construction", 7)
aFeature1Name = aFeature1.data().name()
assert (aFeatureName == aFeature1Name)
assert(len(aGroupFeature.results()) > 0)
aGroupResult = aGroupFeature.firstResult()
assert(aGroupResult)
+assert(aGroupResult.shape())
#=========================================================================
# End of test
#=========================================================================
{
if (myArray.IsNull() || !myArray->IsValid()) { // create array if it is not done yet
if (theSize != 0) { // if size is zero, nothing to do (null array means there is no array)
- myArray = TDataStd_IntegerArray::Set(myLab, 0, theSize);
+ myArray = TDataStd_IntegerArray::Set(myLab, 0, theSize - 1);
owner()->data()->sendAttributeUpdated(this);
}
} else { // reset the old array
#include <Model_Data.h>
#include <Model_Document.h>
-#include <ModelAPI_AttributeIntArray.h>
#include <TNaming_Builder.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Iterator.hxx>
Handle(Model_Application) anApp = Model_Application::getApplication();
bool aFirstCall = !anApp->hasRoot();
if (aFirstCall) {
+ // to be sure that plugins are loaded, even before the first "createFeature" call (in unit tests)
+ LoadPluginsInfo();
// creation of the root document is always outside of the transaction, so, avoid checking it
setCheckTransactions(false);
anApp->createDocument(0); // 0 is a root ID
ADD_UNIT_TESTS(TestConstants.py
TestUndoRedo.py
TestDocument.py
- Test1064.py)
+ Test1064.py
+ TestResults.py)
--- /dev/null
+"""
+ TestResults.py
+ Cover specific working with the data model results
+
+"""
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+
+__updated__ = "2016-20-16"
+
+aSession = ModelAPI_Session.get()
+
+#=========================================================================
+# Check getting the initial construction plane by name
+#=========================================================================
+aPartSet = aSession.moduleDocument()
+aSession.startOperation()
+aPlaneX = aPartSet.objectByName("Construction", "YOZ");
+assert(aPlaneX)
+aColors = aPlaneX.data().intArray("Color")
+assert(aColors)
+# default colors, not filled array
+assert(aColors.size() == 0)
+aColors.setSize(3)
+aColors.setValue(0, 100)
+aColors.setValue(1, 200)
+aColors.setValue(2, 250)
+assert(aColors.size() == 3)
+assert(aColors.value(0) == 100)
+assert(aColors.value(1) == 200)
+assert(aColors.value(2) == 250)
+
+aSession.finishOperation()
+
aFeature.real("y").setValue(-1.)\r
aFeature.real("z").setValue(0.)\r
aFeatureName = aFeature.name()\r
-assert(aFeatureName == "Point_1")\r
+# "2" is because Origin is the first point\r
+assert(aFeatureName == "Point_2")\r
\r
aFeature.execute()\r
aSession.finishOperation()\r
\r
-assert(aDoc.size("Construction") == 1)\r
+assert(aDoc.size("Construction") == 8)\r
assert(aSession.canUndo())\r
assert(not aSession.canRedo())\r
\r
aSession.undo()\r
-assert(aDoc.size("Construction") == 0)\r
+assert(aDoc.size("Construction") == 7)\r
assert(not aSession.canUndo())\r
assert(aSession.canRedo())\r
\r
aSession.redo()\r
-assert(aDoc.size("Construction") == 1)\r
+assert(aDoc.size("Construction") == 8)\r
assert(aSession.canUndo())\r
assert(not aSession.canRedo())\r
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
-#include <ModelAPI_AttributeIntArray.h>
SketchPlugin_SketchEntity::SketchPlugin_SketchEntity()
: SketchPlugin_Feature()