mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0028446: Could not retrieve just kept document with Integer attribute
This commit is contained in:
parent
5a1271c8b4
commit
69f1a8997e
src/TDataStd
tests/caf/basic
@ -28,8 +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();
|
||||||
}
|
}
|
||||||
@ -55,6 +54,25 @@ const Standard_GUID& TDataStd_AsciiString::ID() const
|
|||||||
return myID;
|
return myID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetAttr
|
||||||
|
//purpose : Implements Set functionality
|
||||||
|
//=======================================================================
|
||||||
|
static Handle(TDataStd_AsciiString) SetAttr(
|
||||||
|
const TDF_Label& label,
|
||||||
|
const TCollection_AsciiString& theString,
|
||||||
|
const Standard_GUID& theGuid)
|
||||||
|
{
|
||||||
|
Handle(TDataStd_AsciiString) A;
|
||||||
|
if (!label.FindAttribute(theGuid, A)) {
|
||||||
|
A = new TDataStd_AsciiString ();
|
||||||
|
A->SetID(theGuid);
|
||||||
|
label.AddAttribute(A);
|
||||||
|
}
|
||||||
|
A->Set (theString);
|
||||||
|
return A;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -64,15 +82,7 @@ Handle(TDataStd_AsciiString) TDataStd_AsciiString::Set (
|
|||||||
const TDF_Label& theLabel,
|
const TDF_Label& theLabel,
|
||||||
const TCollection_AsciiString& theAsciiString)
|
const TCollection_AsciiString& theAsciiString)
|
||||||
{
|
{
|
||||||
Handle(TDataStd_AsciiString) A;
|
return SetAttr(theLabel, theAsciiString, GetID());
|
||||||
if (!theLabel.FindAttribute(TDataStd_AsciiString::GetID(), A))
|
|
||||||
{
|
|
||||||
A = new TDataStd_AsciiString;
|
|
||||||
A->SetID(GetID());
|
|
||||||
theLabel.AddAttribute(A);
|
|
||||||
}
|
|
||||||
A->Set(theAsciiString);
|
|
||||||
return A;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -80,17 +90,12 @@ Handle(TDataStd_AsciiString) TDataStd_AsciiString::Set (
|
|||||||
//purpose : Set user defined attribute
|
//purpose : Set user defined attribute
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(TDataStd_AsciiString) TDataStd_AsciiString::Set (const TDF_Label& L, const Standard_GUID& theGuid,
|
Handle(TDataStd_AsciiString) TDataStd_AsciiString::Set (
|
||||||
const TCollection_AsciiString& theAsciiString)
|
const TDF_Label& theLabel,
|
||||||
|
const Standard_GUID& theGuid,
|
||||||
|
const TCollection_AsciiString& theAsciiString)
|
||||||
{
|
{
|
||||||
Handle(TDataStd_AsciiString) A;
|
return SetAttr(theLabel, theAsciiString, theGuid);
|
||||||
if (!L.FindAttribute(theGuid, A)) {
|
|
||||||
A = new TDataStd_AsciiString ();
|
|
||||||
A->SetID(theGuid);
|
|
||||||
L.AddAttribute(A);
|
|
||||||
}
|
|
||||||
A->Set (theAsciiString);
|
|
||||||
return A;
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
@ -143,9 +148,7 @@ void TDataStd_AsciiString::SetID()
|
|||||||
|
|
||||||
Handle(TDF_Attribute) TDataStd_AsciiString::NewEmpty () const
|
Handle(TDF_Attribute) TDataStd_AsciiString::NewEmpty () const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_AsciiString) Att = new TDataStd_AsciiString();
|
return new TDataStd_AsciiString();
|
||||||
Att->SetID(myID);
|
|
||||||
return Att;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -35,6 +35,23 @@ const Standard_GUID& TDataStd_Integer::GetID()
|
|||||||
return TDataStd_IntegerID;
|
return TDataStd_IntegerID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetAttr
|
||||||
|
//purpose : Implements Set functionality
|
||||||
|
//=======================================================================
|
||||||
|
static Handle(TDataStd_Integer) SetAttr(const TDF_Label& label,
|
||||||
|
const Standard_Integer V,
|
||||||
|
const Standard_GUID& theGuid)
|
||||||
|
{
|
||||||
|
Handle(TDataStd_Integer) A;
|
||||||
|
if (!label.FindAttribute(theGuid, A)) {
|
||||||
|
A = new TDataStd_Integer ();
|
||||||
|
A->SetID(theGuid);
|
||||||
|
label.AddAttribute(A);
|
||||||
|
}
|
||||||
|
A->Set (V);
|
||||||
|
return A;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
@ -45,14 +62,7 @@ Handle(TDataStd_Integer) TDataStd_Integer::Set (const TDF_Label& L,
|
|||||||
const Standard_Integer V)
|
const Standard_Integer V)
|
||||||
|
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Integer) A;
|
return SetAttr(L, V, GetID());
|
||||||
if (!L.FindAttribute (TDataStd_Integer::GetID(), A)) {
|
|
||||||
A = new TDataStd_Integer ();
|
|
||||||
A->SetID(GetID());
|
|
||||||
L.AddAttribute(A);
|
|
||||||
}
|
|
||||||
A->Set (V);
|
|
||||||
return A;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -60,17 +70,11 @@ Handle(TDataStd_Integer) TDataStd_Integer::Set (const TDF_Label& L,
|
|||||||
//purpose : Set user defined attribute
|
//purpose : Set user defined attribute
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(TDataStd_Integer) TDataStd_Integer::Set (const TDF_Label& L, const Standard_GUID& theGuid,
|
Handle(TDataStd_Integer) TDataStd_Integer::Set (const TDF_Label& L,
|
||||||
const Standard_Integer V)
|
const Standard_GUID& theGuid,
|
||||||
|
const Standard_Integer V)
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Integer) A;
|
return SetAttr(L, V, theGuid);
|
||||||
if (!L.FindAttribute(theGuid, A)) {
|
|
||||||
A = new TDataStd_Integer ();
|
|
||||||
A->SetID(theGuid);
|
|
||||||
L.AddAttribute(A);
|
|
||||||
}
|
|
||||||
A->Set (V);
|
|
||||||
return A;
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : TDataStd_Integer
|
//function : TDataStd_Integer
|
||||||
@ -78,7 +82,7 @@ Handle(TDataStd_Integer) TDataStd_Integer::Set (const TDF_Label& L, const Sta
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TDataStd_Integer::TDataStd_Integer ()
|
TDataStd_Integer::TDataStd_Integer ()
|
||||||
: myValue (-1), myID (GetID())
|
: myValue (-1)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
@ -152,10 +156,8 @@ void TDataStd_Integer::SetID()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(TDF_Attribute) TDataStd_Integer::NewEmpty () const
|
Handle(TDF_Attribute) TDataStd_Integer::NewEmpty () const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Integer) Att = new TDataStd_Integer();
|
return new TDataStd_Integer();
|
||||||
Att->SetID(myID);
|
|
||||||
return Att;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -40,6 +40,24 @@ const Standard_GUID& TDataStd_Name::GetID ()
|
|||||||
return TDataStd_NameID;
|
return TDataStd_NameID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetAttr
|
||||||
|
//purpose : Implements Set functionality
|
||||||
|
//=======================================================================
|
||||||
|
static Handle(TDataStd_Name) SetAttr(const TDF_Label& label,
|
||||||
|
const TCollection_ExtendedString& theString,
|
||||||
|
const Standard_GUID& theGuid)
|
||||||
|
{
|
||||||
|
Handle(TDataStd_Name) N;
|
||||||
|
if (!label.FindAttribute(theGuid, N)) {
|
||||||
|
N = new TDataStd_Name ();
|
||||||
|
N->SetID(theGuid);
|
||||||
|
label.AddAttribute(N);
|
||||||
|
}
|
||||||
|
N->Set (theString);
|
||||||
|
return N;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -48,14 +66,7 @@ Handle(TDataStd_Name) TDataStd_Name::Set
|
|||||||
(const TDF_Label& label,
|
(const TDF_Label& label,
|
||||||
const TCollection_ExtendedString& theString)
|
const TCollection_ExtendedString& theString)
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Name) N;
|
return SetAttr(label, theString, GetID());
|
||||||
if (!label.FindAttribute(TDataStd_Name::GetID(), N)) {
|
|
||||||
N = new TDataStd_Name ();
|
|
||||||
N->SetID(GetID());
|
|
||||||
label.AddAttribute(N);
|
|
||||||
}
|
|
||||||
N->Set(theString);
|
|
||||||
return N;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -63,25 +74,19 @@ Handle(TDataStd_Name) TDataStd_Name::Set
|
|||||||
//purpose : Set user defined attribute
|
//purpose : Set user defined attribute
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(TDataStd_Name) TDataStd_Name::Set (const TDF_Label& L, const Standard_GUID& theGuid,
|
Handle(TDataStd_Name) TDataStd_Name::Set (const TDF_Label& label,
|
||||||
|
const Standard_GUID& theGuid,
|
||||||
const TCollection_ExtendedString& theString)
|
const TCollection_ExtendedString& theString)
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Name) N;
|
return SetAttr(label, theString, theGuid);
|
||||||
if (!L.FindAttribute(theGuid, N)) {
|
|
||||||
N = new TDataStd_Name ();
|
|
||||||
N->SetID(theGuid);
|
|
||||||
L.AddAttribute(N);
|
|
||||||
}
|
|
||||||
N->Set (theString);
|
|
||||||
return N;
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : TDataStd_Name
|
//function : TDataStd_Name
|
||||||
//purpose : Empty Constructor
|
//purpose : Empty Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TDataStd_Name::TDataStd_Name (): myID (GetID())
|
TDataStd_Name::TDataStd_Name ()
|
||||||
{ }
|
{}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
@ -143,10 +148,8 @@ const Standard_GUID& TDataStd_Name::ID () const { return myID; }
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(TDF_Attribute) TDataStd_Name::NewEmpty () const
|
Handle(TDF_Attribute) TDataStd_Name::NewEmpty () const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Name) Att = new TDataStd_Name();
|
return new TDataStd_Name();
|
||||||
Att->SetID(myID);
|
|
||||||
return Att;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -170,9 +173,9 @@ void TDataStd_Name::Restore(const Handle(TDF_Attribute)& with)
|
|||||||
void TDataStd_Name::Paste (const Handle(TDF_Attribute)& into,
|
void TDataStd_Name::Paste (const Handle(TDF_Attribute)& into,
|
||||||
const Handle(TDF_RelocationTable)&/* RT*/) const
|
const Handle(TDF_RelocationTable)&/* RT*/) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Name) anAtt = Handle(TDataStd_Name)::DownCast (into);
|
Handle(TDataStd_Name) anAtt = Handle(TDataStd_Name)::DownCast (into);
|
||||||
anAtt->Set (myString);
|
anAtt->Set (myString);
|
||||||
anAtt->SetID(myID);
|
anAtt->SetID(myID);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -36,6 +36,23 @@ const Standard_GUID& TDataStd_Real::GetID()
|
|||||||
return TDataStd_RealID;
|
return TDataStd_RealID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetAttr
|
||||||
|
//purpose : Implements Set functionality
|
||||||
|
//=======================================================================
|
||||||
|
static Handle(TDataStd_Real) SetAttr(const TDF_Label& label,
|
||||||
|
const Standard_Real V,
|
||||||
|
const Standard_GUID& theGuid)
|
||||||
|
{
|
||||||
|
Handle(TDataStd_Real) A;
|
||||||
|
if (!label.FindAttribute(theGuid, A)) {
|
||||||
|
A = new TDataStd_Real ();
|
||||||
|
A->SetID(theGuid);
|
||||||
|
label.AddAttribute(A);
|
||||||
|
}
|
||||||
|
A->Set (V);
|
||||||
|
return A;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Set
|
//function : Set
|
||||||
@ -45,14 +62,7 @@ const Standard_GUID& TDataStd_Real::GetID()
|
|||||||
Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L,
|
Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L,
|
||||||
const Standard_Real V)
|
const Standard_Real V)
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Real) A;
|
return SetAttr(L, V, GetID());
|
||||||
if (!L.FindAttribute(TDataStd_Real::GetID(), A)) {
|
|
||||||
A = new TDataStd_Real ();
|
|
||||||
A->SetID(GetID());
|
|
||||||
L.AddAttribute(A);
|
|
||||||
}
|
|
||||||
A->Set (V);
|
|
||||||
return A;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -60,17 +70,11 @@ Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L,
|
|||||||
//purpose : User defined attribute
|
//purpose : User defined attribute
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L, const Standard_GUID& theGuid,
|
Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L,
|
||||||
|
const Standard_GUID& theGuid,
|
||||||
const Standard_Real V)
|
const Standard_Real V)
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Real) A;
|
return SetAttr(L, V, theGuid);
|
||||||
if (!L.FindAttribute(theGuid, A)) {
|
|
||||||
A = new TDataStd_Real ();
|
|
||||||
A->SetID(theGuid);
|
|
||||||
L.AddAttribute(A);
|
|
||||||
}
|
|
||||||
A->Set (V);
|
|
||||||
return A;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -80,8 +84,7 @@ Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L, const Standard_
|
|||||||
|
|
||||||
TDataStd_Real::TDataStd_Real ()
|
TDataStd_Real::TDataStd_Real ()
|
||||||
: myValue (RealFirst()),
|
: myValue (RealFirst()),
|
||||||
myDimension (TDataStd_SCALAR),
|
myDimension (TDataStd_SCALAR)
|
||||||
myID (GetID())
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -188,10 +191,8 @@ void TDataStd_Real::SetID()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Handle(TDF_Attribute) TDataStd_Real::NewEmpty () const
|
Handle(TDF_Attribute) TDataStd_Real::NewEmpty () const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Real) Att = new TDataStd_Real();
|
return new TDataStd_Real();
|
||||||
Att->SetID(myID);
|
|
||||||
return Att;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
58
tests/caf/basic/A7
Normal file
58
tests/caf/basic/A7
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#INTERFACE CAF
|
||||||
|
# Basic attributes
|
||||||
|
#
|
||||||
|
# Testing attribute: User defined (additional GUID) TDataStd_Integer
|
||||||
|
#
|
||||||
|
# Testing command: SetInteger
|
||||||
|
# Testing command: GetInteger
|
||||||
|
#
|
||||||
|
|
||||||
|
puts "caf001-A6"
|
||||||
|
|
||||||
|
# Add an attribute to a data framework
|
||||||
|
set aSetAttr1 100
|
||||||
|
set aSetAttr2 200
|
||||||
|
set aGuid1 "12e94541-6dbc-11d4-b9c8-0060b0ee281b"
|
||||||
|
|
||||||
|
set aLabel 0:2
|
||||||
|
SetInteger D ${aLabel} ${aSetAttr1}
|
||||||
|
SetInteger D ${aLabel} ${aSetAttr2} ${aGuid1}
|
||||||
|
|
||||||
|
# Close/Open the transaction
|
||||||
|
NewCommand D
|
||||||
|
|
||||||
|
# Save the document
|
||||||
|
set aFile ${imagedir}/caf001-A7.cbf
|
||||||
|
file delete ${aFile}
|
||||||
|
SaveAs D ${aFile}
|
||||||
|
if { ![file exists ${aFile}] } {
|
||||||
|
puts "There is not ${aFile} file; SaveAs command: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#catch {exec chmod 777 ${aFile}}
|
||||||
|
|
||||||
|
# Restore the document
|
||||||
|
Close D
|
||||||
|
Open ${aFile} DD
|
||||||
|
|
||||||
|
# Get a value of the attribute #1
|
||||||
|
set IsDone [catch {set aGetAttr3 [GetInteger DD ${aLabel}]} aResult]
|
||||||
|
if { ${IsDone} != 0 ||
|
||||||
|
${aSetAttr1}!=${aGetAttr3} } {
|
||||||
|
puts ${aResult}
|
||||||
|
puts "aSetAttr1=${aSetAttr1} aGetAttr3=${aGetAttr3}"
|
||||||
|
puts "Get a value of the first TDataStd_Integer attribute from restoring document: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get a value of the attribute #2
|
||||||
|
set IsDone [catch {set aGetAttr4 [GetInteger DD ${aLabel} ${aGuid1}]} aResult]
|
||||||
|
if { ${IsDone} != 0 ||
|
||||||
|
${aSetAttr2}!=${aGetAttr4} } {
|
||||||
|
puts ${aResult}
|
||||||
|
puts "aSetAttr2=${aSetAttr2} aGetAttr4=${aGetAttr4}"
|
||||||
|
puts "Get a value of the second TDataStd_Integer attribute from restoring document: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
puts "Get a value of user defined TDataStd_Integer attributes from restoring document: OK"
|
57
tests/caf/basic/B7
Normal file
57
tests/caf/basic/B7
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#INTERFACE CAF
|
||||||
|
# Basic attributes
|
||||||
|
#
|
||||||
|
# Testing attribute: User defined (additional GUID) TDataStd_Real
|
||||||
|
#
|
||||||
|
# Testing command: SetReal
|
||||||
|
# Testing command: GetReal
|
||||||
|
#
|
||||||
|
|
||||||
|
puts "caf001-B6"
|
||||||
|
|
||||||
|
# Add an attribute to a data framework
|
||||||
|
set aSetAttr1 100.11
|
||||||
|
set aSetAttr2 200.11
|
||||||
|
set aGuid2 "12e94552-6dbc-11d4-b9c8-0060b0ee281b"
|
||||||
|
set aLabel 0:2
|
||||||
|
SetReal D ${aLabel} ${aSetAttr1}
|
||||||
|
SetReal D ${aLabel} ${aSetAttr2} ${aGuid2}
|
||||||
|
|
||||||
|
# Close/Open the transaction
|
||||||
|
NewCommand D
|
||||||
|
|
||||||
|
# Save the document
|
||||||
|
set aFile ${imagedir}/caf001-B7.cbf
|
||||||
|
file delete ${aFile}
|
||||||
|
SaveAs D ${aFile}
|
||||||
|
if { ![file exists ${aFile}] } {
|
||||||
|
puts "There is not ${aFile} file; SaveAs command: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#catch {exec chmod 777 ${aFile}}
|
||||||
|
|
||||||
|
# Restore the document
|
||||||
|
Close D
|
||||||
|
Open ${aFile} DD
|
||||||
|
|
||||||
|
# Get a value of the attribute #1
|
||||||
|
set IsDone [catch {set aGetAttr3 [GetReal DD ${aLabel}]} aResult]
|
||||||
|
if { ${IsDone} != 0 ||
|
||||||
|
${aSetAttr1}!=${aGetAttr3} } {
|
||||||
|
puts ${aResult}
|
||||||
|
puts "aSetAttr1=${aSetAttr1} aGetAttr3=${aGetAttr3}"
|
||||||
|
puts "Get a value of the first TDataStd_Real attribute from restoring document: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get a value of the attribute #2
|
||||||
|
set IsDone [catch {set aGetAttr4 [GetReal DD ${aLabel} ${aGuid2}]} aResult]
|
||||||
|
if { ${IsDone} != 0 ||
|
||||||
|
${aSetAttr2}!=${aGetAttr4} } {
|
||||||
|
puts ${aResult}
|
||||||
|
puts "aSetAttr2=${aSetAttr2} aGetAttr4=${aGetAttr4}"
|
||||||
|
puts "Get a value of the second TDataStd_Real attribute from restoring document: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
puts "Get a value of user defined TDataStd_Integer attributes from restoring document: OK"
|
57
tests/caf/basic/E7
Normal file
57
tests/caf/basic/E7
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#INTERFACE CAF
|
||||||
|
# Basic attributes
|
||||||
|
#
|
||||||
|
# Testing attribute: User defined (additional GUID) TDataStd_Name
|
||||||
|
#
|
||||||
|
# Testing command: SetName
|
||||||
|
# Testing command: GetName
|
||||||
|
#
|
||||||
|
|
||||||
|
puts "caf001-E6"
|
||||||
|
|
||||||
|
# Add an attribute to a data framework
|
||||||
|
set aSetAttr1 "New Attribute_1"
|
||||||
|
set aSetAttr2 "New Attribute_2"
|
||||||
|
set aGuid2 "12e94562-6dbc-11d4-b9c8-0060b0ee281b"
|
||||||
|
set aLabel 0:2
|
||||||
|
SetName D ${aLabel} ${aSetAttr1}
|
||||||
|
SetName D ${aLabel} ${aSetAttr2} ${aGuid2}
|
||||||
|
|
||||||
|
# Close/Open the transaction
|
||||||
|
NewCommand D
|
||||||
|
|
||||||
|
# Save the document
|
||||||
|
set aFile ${imagedir}/caf001-E7.cbf
|
||||||
|
file delete ${aFile}
|
||||||
|
SaveAs D ${aFile}
|
||||||
|
if { ![file exists ${aFile}] } {
|
||||||
|
puts "There is not ${aFile} file; SaveAs command: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#catch {exec chmod 777 ${aFile}}
|
||||||
|
|
||||||
|
# Restore the document
|
||||||
|
Close D
|
||||||
|
Open ${aFile} DD
|
||||||
|
|
||||||
|
# Get a value of the attribute #1
|
||||||
|
set IsDone [catch {set aGetAttr3 [GetName DD ${aLabel}]} aResult]
|
||||||
|
if { ${IsDone} != 0 ||
|
||||||
|
${aSetAttr1}!=${aGetAttr3} } {
|
||||||
|
puts ${aResult}
|
||||||
|
puts "aSetAttr1=${aSetAttr1} aGetAttr3=${aGetAttr3}"
|
||||||
|
puts "Get a value of the first TDataStd_Name attribute from restoring document: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get a value of the attribute #2
|
||||||
|
set IsDone [catch {set aGetAttr4 [GetName DD ${aLabel} ${aGuid2}]} aResult]
|
||||||
|
if { ${IsDone} != 0 ||
|
||||||
|
${aSetAttr2}!=${aGetAttr4} } {
|
||||||
|
puts ${aResult}
|
||||||
|
puts "aSetAttr2=${aSetAttr2} aGetAttr4=${aGetAttr4}"
|
||||||
|
puts "Get a value of the second TDataStd_Name attribute from restoring document: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
puts "Get a value of user defined TDataStd_Name attributes from restoring document: OK"
|
57
tests/caf/basic/N7
Normal file
57
tests/caf/basic/N7
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#INTERFACE CAF
|
||||||
|
# Basic attributes
|
||||||
|
#
|
||||||
|
# Testing attribute: User defined (additional GUID) TDataStd_AsciiString
|
||||||
|
#
|
||||||
|
# Testing command: SetAsciiString
|
||||||
|
# Testing command: GetAsciiString
|
||||||
|
#
|
||||||
|
|
||||||
|
puts "caf001-N6"
|
||||||
|
|
||||||
|
# Add an attribute to a data framework
|
||||||
|
set aSetAttr1 "New Attribute_1"
|
||||||
|
set aSetAttr2 "New Attribute_2"
|
||||||
|
set aGuid2 "12e94572-6dbc-11d4-b9c8-0060b0ee281b"
|
||||||
|
set aLabel 0:2
|
||||||
|
SetAsciiString D ${aLabel} ${aSetAttr1}
|
||||||
|
SetAsciiString D ${aLabel} ${aSetAttr2} ${aGuid2}
|
||||||
|
|
||||||
|
# Close/Open the transaction
|
||||||
|
NewCommand D
|
||||||
|
|
||||||
|
# Save the document
|
||||||
|
set aFile ${imagedir}/caf001-N7.cbf
|
||||||
|
file delete ${aFile}
|
||||||
|
SaveAs D ${aFile}
|
||||||
|
if { ![file exists ${aFile}] } {
|
||||||
|
puts "There is not ${aFile} file; SaveAs command: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#catch {exec chmod 777 ${aFile}}
|
||||||
|
|
||||||
|
# Restore the document
|
||||||
|
Close D
|
||||||
|
Open ${aFile} DD
|
||||||
|
|
||||||
|
# Get a value of the attribute #1
|
||||||
|
set IsDone [catch {set aGetAttr3 [GetAsciiString DD ${aLabel}]} aResult]
|
||||||
|
if { ${IsDone} != 0 ||
|
||||||
|
${aSetAttr1}!=${aGetAttr3} } {
|
||||||
|
puts ${aResult}
|
||||||
|
puts "aSetAttr1=${aSetAttr1} aGetAttr3=${aGetAttr3}"
|
||||||
|
puts "Get a value of the first TDataStd_AsciiString attribute from restoring document: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get a value of the attribute #2
|
||||||
|
set IsDone [catch {set aGetAttr4 [GetAsciiString DD ${aLabel} ${aGuid2}]} aResult]
|
||||||
|
if { ${IsDone} != 0 ||
|
||||||
|
${aSetAttr2}!=${aGetAttr4} } {
|
||||||
|
puts ${aResult}
|
||||||
|
puts "aSetAttr2=${aSetAttr2} aGetAttr4=${aGetAttr4}"
|
||||||
|
puts "Get a value of the second TDataStd_AsciiString attribute from restoring document: Error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
puts "Get a value of user defined TDataStd_AsciiString attributes from restoring document: OK"
|
Loading…
x
Reference in New Issue
Block a user