File size: 3,239 Bytes
985c397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# SPDX-License-Identifier: LGPL-2.1-or-later

# ***************************************************************************
# *                                                                         *
# *   Copyright (c) 2025 Furgo                                              *
# *                                                                         *
# *   This file is part of FreeCAD.                                         *
# *                                                                         *
# *   FreeCAD is free software: you can redistribute it and/or modify it    *
# *   under the terms of the GNU Lesser General Public License as           *
# *   published by the Free Software Foundation, either version 2.1 of the  *
# *   License, or (at your option) any later version.                       *
# *                                                                         *
# *   FreeCAD is distributed in the hope that it will be useful, but        *
# *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      *
# *   Lesser General Public License for more details.                       *
# *                                                                         *
# *   You should have received a copy of the GNU Lesser General Public      *
# *   License along with FreeCAD. If not, see                               *
# *   <https://www.gnu.org/licenses/>.                                      *
# *                                                                         *
# ***************************************************************************

import FreeCAD as App
import Arch
from bimtests import TestArchBase


class TestArchAxis(TestArchBase.TestArchBase):

    def test_make_axis_default(self):
        axis = Arch.makeAxis()
        self.assertIsNotNone(axis, "Failed to create a default axis")

    def test_make_axis_custom(self):
        axis = Arch.makeAxis(num=3, size=2000)
        self.assertEqual(len(axis.Distances), 3, "Incorrect number of axes created")
        self.assertEqual(axis.Distances[1], 2000, "Axis size is incorrect")

    def test_axis_properties(self):
        axis = Arch.makeAxis()
        self.assertEqual(axis.Label, "Axes", "Default label is incorrect")

    def test_makeAxis(self):
        """Test the makeAxis function."""
        operation = "Testing makeAxis function"
        self.printTestMessage(operation)

        axis = Arch.makeAxis(num=2, size=500)
        self.assertIsNotNone(axis, "makeAxis failed to create an axis object.")
        self.assertEqual(axis.Label, "Axes", "Axis label is incorrect.")

    def test_makeAxisSystem(self):
        """Test the makeAxisSystem function."""
        operation = "Testing makeAxisSystem function"
        self.printTestMessage(operation)

        axis1 = Arch.makeAxis(num=1, size=1000)
        axis2 = Arch.makeAxis(num=1, size=2000)
        axis_system = Arch.makeAxisSystem([axis1, axis2], name="TestAxisSystem")
        self.assertIsNotNone(axis_system, "makeAxisSystem failed to create an axis system.")
        self.assertEqual(axis_system.Label, "TestAxisSystem", "Axis system label is incorrect.")