1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 * Check all methods of SALOMEDS_AttributeStudyProperties
24 * Use code of SALOMEDS_AttributeStudyProperties.cxx
26 void SALOMEDSTest::testAttributeStudyProperties()
28 //Create or find the Study manager
29 _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
34 _PTR(Study) study = sm->NewStudy("Test");
36 CPPUNIT_ASSERT(study);
38 //Create Study Builder
39 _PTR(StudyBuilder) studyBuilder = study->NewBuilder();
41 CPPUNIT_ASSERT(studyBuilder);
43 //Create a SObject with entry 0:1:1
44 _PTR(SObject) so = study->CreateObjectID("0:1:1");
48 //Create an attribute AttributeStudyProperties
49 _PTR(AttributeStudyProperties) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeStudyProperties");
51 //Check the attribute creation
52 CPPUNIT_ASSERT(_attr);
54 //Check method SetCreationDate
55 _attr->SetCreationDate(1, 2, 3, 4, 5);
57 //Check method GetCreationDate
59 _attr->GetCreationDate(MN, H, D, MH, Y);
61 CPPUNIT_ASSERT(MN == 1 && H == 2 && D == 3 && MH == 4 && Y == 5);
63 //Check method SetUserName
64 _attr->SetUserName("srn");
66 //Check method GetUserName
67 CPPUNIT_ASSERT(_attr->GetUserName() == "srn");
69 //Check method SetCreationMode
70 string value = "from scratch";
71 _attr->SetCreationMode(value);
73 //Check method GetCreationMode
74 CPPUNIT_ASSERT(_attr->GetCreationMode() == value);
76 //Check method SetModified
77 _attr->SetModified(2);
79 //Check method IsModified
80 CPPUNIT_ASSERT(_attr->IsModified());
82 //Check method GetModified
83 CPPUNIT_ASSERT(_attr->GetModified() == 2);
85 //Check method SetLocked
86 _attr->SetLocked(true);
88 //Check method IsLocked
89 CPPUNIT_ASSERT(_attr->IsLocked());
91 _attr->SetLocked(false);
93 CPPUNIT_ASSERT(!_attr->IsLocked());
95 //Check method SetModification
96 _attr->SetModification("srn2", 6, 7, 8, 9, 10);
98 //Check method GetModificationsList
101 _attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], false);
102 CPPUNIT_ASSERT(vs[0] == "srn2" && vi[0][0] == 6 && vi[1][0] == 7 && vi[2][0] == 8 && vi[3][0] == 9 && vi[4][0] == 10);
105 for(int i=0; i<5; i++) vi[i].clear();
107 _attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], true);
108 CPPUNIT_ASSERT(vs[0] == "srn" && vi[0][0] == 1 && vi[1][0] == 2 && vi[2][0] == 3 && vi[3][0] == 4 && vi[4][0] == 5);