1 // Copyright (C) 2006 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 * Check all methods of SALOMEDS_AttributeStudyProperties
23 * Use code of SALOMEDS_AttributeStudyProperties.cxx
25 void SALOMEDSTest::testAttributeStudyProperties()
27 //Create or find the Study manager
28 _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
33 _PTR(Study) study = sm->NewStudy("Test");
35 CPPUNIT_ASSERT(study);
37 //Create Study Builder
38 _PTR(StudyBuilder) studyBuilder = study->NewBuilder();
40 CPPUNIT_ASSERT(studyBuilder);
42 //Create a SObject with entry 0:1:1
43 _PTR(SObject) so = study->CreateObjectID("0:1:1");
47 //Create an attribute AttributeStudyProperties
48 _PTR(AttributeStudyProperties) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeStudyProperties");
50 //Check the attribute creation
51 CPPUNIT_ASSERT(_attr);
53 //Check method SetCreationDate
54 _attr->SetCreationDate(1, 2, 3, 4, 5);
56 //Check method GetCreationDate
58 _attr->GetCreationDate(MN, H, D, MH, Y);
60 CPPUNIT_ASSERT(MN == 1 && H == 2 && D == 3 && MH == 4 && Y == 5);
62 //Check method SetUserName
63 _attr->SetUserName("srn");
65 //Check method GetUserName
66 CPPUNIT_ASSERT(_attr->GetUserName() == "srn");
68 //Check method SetCreationMode
69 string value = "from scratch";
70 _attr->SetCreationMode(value);
72 //Check method GetCreationMode
73 CPPUNIT_ASSERT(_attr->GetCreationMode() == value);
75 //Check method SetModified
76 _attr->SetModified(2);
78 //Check method IsModified
79 CPPUNIT_ASSERT(_attr->IsModified());
81 //Check method GetModified
82 CPPUNIT_ASSERT(_attr->GetModified() == 2);
84 //Check method SetLocked
85 _attr->SetLocked(true);
87 //Check method IsLocked
88 CPPUNIT_ASSERT(_attr->IsLocked());
90 _attr->SetLocked(false);
92 CPPUNIT_ASSERT(!_attr->IsLocked());
94 //Check method SetModification
95 _attr->SetModification("srn2", 6, 7, 8, 9, 10);
97 //Check method GetModificationsList
100 _attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], false);
101 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);
104 for(int i=0; i<5; i++) vi[i].clear();
106 _attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], true);
107 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);