]> SALOME platform Git repositories - modules/shaper.git/blob - src/Config/Test/TestConfig.py
Salome HOME
[Code coverage Config]: Unit test for Config_PropManager
[modules/shaper.git] / src / Config / Test / TestConfig.py
1 ## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
2 ##
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
7 ##
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 ## Lesser General Public License for more details.
12 ##
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 ##
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 from ModelAPI import *
22 from ConfigAPI import *
23
24 # register boolean property
25 Config_PropManager().registerProp("TestSection", "PropBool", "PropTitle", Config_Prop.Boolean)
26 # check property once again
27 Config_PropManager().registerProp("TestSection", "PropBool", "PropTitle", Config_Prop.Boolean, "true")
28 # check property value
29 assert(Config_PropManager().boolean("TestSection", "PropBool"))
30
31 # register real property
32 Config_PropManager().registerProp("TestSection", "PropDouble", "PropTitle", Config_Prop.Double, "12,5")
33 # check property (',' should be substituted by ".")
34 assert(Config_PropManager().real("TestSection", "PropDouble") == 12.5)
35
36 # register color property
37 Config_PropManager().registerProp("TestSection", "PropColor", "PropTitle", Config_Prop.Color, "#B00F00")
38 assert(len(Config_PropManager().color("TestSection", "PropColor")) == 3)
39
40 # check sections and properties are not empty
41 assert(len(Config_PropManager().getSections()) > 0)
42 assert(len(Config_PropManager().getProperties()) > 0)