mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0029371: The problem of the attributes constructor call
Default Guid is assigned in constructor. Add test case: tests\bugs\caf\bug29371.
This commit is contained in:
parent
153fee015d
commit
4a5eefb909
@ -2590,6 +2590,184 @@ static Standard_Integer OCC29289(Draw_Interpretor&, Standard_Integer , const cha
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===============================================================================================
|
||||||
|
Standard_Boolean IsSameGuid (const Standard_GUID& aGuidNull, const Standard_GUID& aGuid2)
|
||||||
|
{
|
||||||
|
Standard_Boolean isSame (Standard_False);
|
||||||
|
if(Standard_GUID::IsEqual(aGuidNull, aGuid2)) {
|
||||||
|
aGuid2.ShallowDump(cout);
|
||||||
|
isSame = Standard_True;
|
||||||
|
} else {
|
||||||
|
aGuid2.ShallowDump(cout);
|
||||||
|
cout <<endl;
|
||||||
|
}
|
||||||
|
return isSame;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <TDataStd_AsciiString.hxx>
|
||||||
|
#include <TDataStd_BooleanArray.hxx>
|
||||||
|
#include <TDataStd_BooleanList.hxx>
|
||||||
|
#include <TDataStd_ByteArray.hxx>
|
||||||
|
#include <TDataStd_ExtStringArray.hxx>
|
||||||
|
#include <TDataStd_ExtStringList.hxx>
|
||||||
|
#include <TDataStd_Integer.hxx>
|
||||||
|
#include <TDataStd_IntegerArray.hxx>
|
||||||
|
#include <TDataStd_IntegerList.hxx>
|
||||||
|
#include <TDataStd_Name.hxx>
|
||||||
|
#include <TDataStd_Real.hxx>
|
||||||
|
#include <TDataStd_RealArray.hxx>
|
||||||
|
#include <TDataStd_RealList.hxx>
|
||||||
|
#include <TDataStd_ReferenceArray.hxx>
|
||||||
|
#include <TDataStd_ReferenceList.hxx>
|
||||||
|
|
||||||
|
#define QCOMPARE(val1, val2) \
|
||||||
|
di << "Checking " #val1 " == " #val2 << \
|
||||||
|
((val1) == (val2) ? ": OK\n" : ": Error\n")
|
||||||
|
|
||||||
|
static Standard_Integer OCC29371 (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||||
|
{
|
||||||
|
if (n != 1)
|
||||||
|
{
|
||||||
|
std::cout << "Usage : " << a[0] << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
|
||||||
|
Handle(TDocStd_Document) aDoc;
|
||||||
|
anApp->NewDocument ("BinOcaf", aDoc);
|
||||||
|
TDF_Label aLab = aDoc->Main();
|
||||||
|
Standard_GUID aNullGuid("00000000-0000-0000-0000-000000000000");
|
||||||
|
Standard_Boolean IsNullGuid(Standard_False);
|
||||||
|
|
||||||
|
try {
|
||||||
|
//1. Set TDataStd_AsciiString
|
||||||
|
Handle(TDataStd_AsciiString) aStrAtt = new TDataStd_AsciiString();
|
||||||
|
aLab.AddAttribute(aStrAtt);
|
||||||
|
if(!aStrAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aStrAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//2. Set TDataStd_BooleanArray
|
||||||
|
Handle(TDataStd_BooleanArray) aBArAtt = new TDataStd_BooleanArray();
|
||||||
|
aLab.AddAttribute(aBArAtt);
|
||||||
|
if(!aBArAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aBArAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//3. Set TDataStd_BooleanList
|
||||||
|
Handle(TDataStd_BooleanList) aBListAtt = new TDataStd_BooleanList();
|
||||||
|
aLab.AddAttribute(aBListAtt);
|
||||||
|
if(!aBListAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aBListAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//4. Set TDataStd_ByteArray
|
||||||
|
Handle(TDataStd_ByteArray) aByteArAtt = new TDataStd_ByteArray();
|
||||||
|
aLab.AddAttribute(aByteArAtt);
|
||||||
|
if(!aByteArAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aByteArAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//5. Set TDataStd_ExtStringArray
|
||||||
|
Handle(TDataStd_ExtStringArray) anExtStrArAtt = new TDataStd_ExtStringArray();
|
||||||
|
aLab.AddAttribute(anExtStrArAtt);
|
||||||
|
if(!anExtStrArAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = anExtStrArAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//6. Set TDataStd_ExtStringList
|
||||||
|
Handle(TDataStd_ExtStringList) anExtStrListAtt = new TDataStd_ExtStringList();
|
||||||
|
aLab.AddAttribute(anExtStrListAtt);
|
||||||
|
if(!anExtStrListAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = anExtStrListAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//7. Set TDataStd_Integer
|
||||||
|
Handle(TDataStd_Integer) anIntAtt = new TDataStd_Integer();
|
||||||
|
aLab.AddAttribute(anIntAtt);
|
||||||
|
if(!anIntAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = anIntAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//8. Set TDataStd_IntegerArray
|
||||||
|
Handle(TDataStd_IntegerArray) anIntArrAtt = new TDataStd_IntegerArray();
|
||||||
|
aLab.AddAttribute(anIntArrAtt);
|
||||||
|
if(!anIntArrAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = anIntArrAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//9. Set TDataStd_IntegerList
|
||||||
|
Handle(TDataStd_IntegerList) anIntListAtt = new TDataStd_IntegerList();
|
||||||
|
aLab.AddAttribute(anIntListAtt);
|
||||||
|
if(!anIntListAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = anIntListAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//10. Set TDataStd_Name
|
||||||
|
Handle(TDataStd_Name) aNameAtt = new TDataStd_Name();
|
||||||
|
aLab.AddAttribute(aNameAtt);
|
||||||
|
if(!aNameAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aNameAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//11. Set TDataStd_Real
|
||||||
|
Handle(TDataStd_Real) aRealAtt = new TDataStd_Real();
|
||||||
|
aLab.AddAttribute(aRealAtt);
|
||||||
|
if(!aRealAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aRealAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//12. Set TDataStd_RealArray
|
||||||
|
Handle(TDataStd_RealArray) aRealArrAtt = new TDataStd_RealArray();
|
||||||
|
aLab.AddAttribute(aRealArrAtt);
|
||||||
|
if(!aRealArrAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aRealArrAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//13. Set TDataStd_RealList
|
||||||
|
Handle(TDataStd_RealList) aRealListAtt = new TDataStd_RealList();
|
||||||
|
aLab.AddAttribute(aRealListAtt);
|
||||||
|
if(!aRealListAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aRealListAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//14. Set TDataStd_ReferenceArray
|
||||||
|
Handle(TDataStd_ReferenceArray) aRefArrAtt = new TDataStd_ReferenceArray();
|
||||||
|
aLab.AddAttribute(aRefArrAtt);
|
||||||
|
if(!aRefArrAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aRefArrAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//15. Set TDataStd_ReferenceList
|
||||||
|
Handle(TDataStd_ReferenceList) aRefListAtt = new TDataStd_ReferenceList();
|
||||||
|
aLab.AddAttribute(aRefListAtt);
|
||||||
|
if(!aRefListAtt.IsNull()) {
|
||||||
|
Standard_GUID aGuid = aRefListAtt->ID();
|
||||||
|
IsNullGuid = IsSameGuid(aNullGuid, aGuid);
|
||||||
|
}
|
||||||
|
} catch (...)
|
||||||
|
{
|
||||||
|
IsNullGuid = Standard_True;
|
||||||
|
}
|
||||||
|
QCOMPARE (IsNullGuid, Standard_False);
|
||||||
|
anApp->Close(aDoc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||||
const char *group = "QABugs";
|
const char *group = "QABugs";
|
||||||
|
|
||||||
@ -2619,6 +2797,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
|||||||
__FILE__, OCC28887, group);
|
__FILE__, OCC28887, group);
|
||||||
theCommands.Add("OCC28131", "OCC28131 name: creates face problematic for offset", __FILE__, OCC28131, group);
|
theCommands.Add("OCC28131", "OCC28131 name: creates face problematic for offset", __FILE__, OCC28131, group);
|
||||||
theCommands.Add("OCC29289", "OCC29289 : searching trigonometric root by Newton iterations", __FILE__, OCC29289, group);
|
theCommands.Add("OCC29289", "OCC29289 : searching trigonometric root by Newton iterations", __FILE__, OCC29289, group);
|
||||||
|
theCommands.Add ("OCC29371", "OCC29371", __FILE__, OCC29371, group);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(TDataStd_AsciiString,TDF_Attribute)
|
|||||||
//function : TDataStd_AsciiString
|
//function : TDataStd_AsciiString
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_AsciiString::TDataStd_AsciiString()
|
TDataStd_AsciiString::TDataStd_AsciiString(): myID(GetID())
|
||||||
{
|
{
|
||||||
myString.Clear();
|
myString.Clear();
|
||||||
}
|
}
|
||||||
|
@ -87,10 +87,8 @@ static Handle(TDataStd_BooleanArray) SetAttr(const TDF_Label& label,
|
|||||||
//function : TDataStd_BooleanArray
|
//function : TDataStd_BooleanArray
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_BooleanArray::TDataStd_BooleanArray()
|
TDataStd_BooleanArray::TDataStd_BooleanArray() : myID(GetID())
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Init
|
//function : Init
|
||||||
|
@ -55,10 +55,8 @@ static Handle(TDataStd_BooleanList) SetAttr(const TDF_Label& label,
|
|||||||
//function : TDataStd_BooleanList
|
//function : TDataStd_BooleanList
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_BooleanList::TDataStd_BooleanList()
|
TDataStd_BooleanList::TDataStd_BooleanList() : myID(GetID())
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
|
@ -40,7 +40,8 @@ const Standard_GUID& TDataStd_ByteArray::GetID()
|
|||||||
//function : TDataStd_ByteArray
|
//function : TDataStd_ByteArray
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_ByteArray::TDataStd_ByteArray() : myIsDelta(Standard_False)
|
TDataStd_ByteArray::TDataStd_ByteArray() : myIsDelta(Standard_False),
|
||||||
|
myID(GetID())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -68,7 +68,8 @@ Handle(TDataStd_ExtStringArray) SetAttr(const TDF_Label& label,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TDataStd_ExtStringArray::TDataStd_ExtStringArray()
|
TDataStd_ExtStringArray::TDataStd_ExtStringArray()
|
||||||
: myIsDelta(Standard_False){}
|
: myIsDelta(Standard_False), myID(GetID())
|
||||||
|
{}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Init
|
//function : Init
|
||||||
|
@ -56,7 +56,7 @@ static Handle(TDataStd_ExtStringList) SetAttr(const TDF_Label& label,
|
|||||||
//function : TDataStd_ExtStringList
|
//function : TDataStd_ExtStringList
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_ExtStringList::TDataStd_ExtStringList()
|
TDataStd_ExtStringList::TDataStd_ExtStringList() : myID(GetID())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -82,7 +82,7 @@ Handle(TDataStd_Integer) TDataStd_Integer::Set (const TDF_Label& L,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TDataStd_Integer::TDataStd_Integer ()
|
TDataStd_Integer::TDataStd_Integer ()
|
||||||
: myValue (-1)
|
: myValue (-1), myID(GetID())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ static Handle(TDataStd_IntegerArray) SetAttr(const TDF_Label& label,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TDataStd_IntegerArray::TDataStd_IntegerArray()
|
TDataStd_IntegerArray::TDataStd_IntegerArray()
|
||||||
:myIsDelta(Standard_False)
|
:myIsDelta(Standard_False), myID(GetID())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -55,10 +55,8 @@ static Handle(TDataStd_IntegerList) SetAttr(const TDF_Label& label,
|
|||||||
//function : TDataStd_IntegerList
|
//function : TDataStd_IntegerList
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_IntegerList::TDataStd_IntegerList()
|
TDataStd_IntegerList::TDataStd_IntegerList() : myID(GetID())
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
|
@ -85,7 +85,7 @@ Handle(TDataStd_Name) TDataStd_Name::Set (const TDF_Label& label,
|
|||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TDataStd_Name::TDataStd_Name ()
|
TDataStd_Name::TDataStd_Name () : myID(GetID())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -84,7 +84,8 @@ Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L,
|
|||||||
|
|
||||||
TDataStd_Real::TDataStd_Real ()
|
TDataStd_Real::TDataStd_Real ()
|
||||||
: myValue (RealFirst()),
|
: myValue (RealFirst()),
|
||||||
myDimension (TDataStd_SCALAR)
|
myDimension (TDataStd_SCALAR),
|
||||||
|
myID(GetID())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,8 @@ static Handle(TDataStd_RealArray) SetAttr(const TDF_Label& label,
|
|||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TDataStd_RealArray::TDataStd_RealArray() : myIsDelta(Standard_False)
|
TDataStd_RealArray::TDataStd_RealArray() : myIsDelta(Standard_False),
|
||||||
|
myID(GetID())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -55,10 +55,8 @@ static Handle(TDataStd_RealList) SetAttr(const TDF_Label& label,
|
|||||||
//function : TDataStd_RealList
|
//function : TDataStd_RealList
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_RealList::TDataStd_RealList()
|
TDataStd_RealList::TDataStd_RealList() : myID(GetID())
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
|
@ -62,10 +62,8 @@ static Handle(TDataStd_ReferenceArray) SetAttr(const TDF_Label& label,
|
|||||||
//function : TDataStd_ReferenceArray
|
//function : TDataStd_ReferenceArray
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_ReferenceArray::TDataStd_ReferenceArray()
|
TDataStd_ReferenceArray::TDataStd_ReferenceArray() : myID(GetID())
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Init
|
//function : Init
|
||||||
|
@ -56,10 +56,8 @@ static Handle(TDataStd_ReferenceList) SetAttr(const TDF_Label& label,
|
|||||||
//function : TDataStd_ReferenceList
|
//function : TDataStd_ReferenceList
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
TDataStd_ReferenceList::TDataStd_ReferenceList()
|
TDataStd_ReferenceList::TDataStd_ReferenceList() : myID(GetID())
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
|
8
tests/bugs/caf/bug29371
Normal file
8
tests/bugs/caf/bug29371
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
puts "==========="
|
||||||
|
puts "OCC29371"
|
||||||
|
puts "==========="
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
OCC29371
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user