2
# ***************************************************************************
3
# * Copyright (c) 2019 sliptonic <shopinthewoods@gmail.com> *
5
# * This program is free software; you can redistribute it and/or modify *
6
# * it under the terms of the GNU Lesser General Public License (LGPL) *
7
# * as published by the Free Software Foundation; either version 2 of *
8
# * the License, or (at your option) any later version. *
9
# * for detail see the LICENCE text file. *
11
# * This program 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 *
14
# * GNU Library General Public License for more details. *
16
# * You should have received a copy of the GNU Library General Public *
17
# * License along with this program; if not, write to the Free Software *
18
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
21
# ***************************************************************************
24
import Tests.PathTestUtils as PathTestUtils
27
class TestPathPreferences(PathTestUtils.PathTestBase):
29
"""There is at least one search path."""
31
paths = Path.Preferences.searchPaths()
32
self.assertGreater(len(paths), 0)
35
"""Path/Post is part of the posts search path."""
36
paths = Path.Preferences.searchPathsPost()
37
self.assertEqual(len([p for p in paths if p.endswith("/Path/Post/")]), 1)
40
"""Path/Post/scripts is part of the posts search path."""
41
paths = Path.Preferences.searchPathsPost()
42
self.assertEqual(len([p for p in paths if p.endswith("/Path/Post/scripts/")]), 1)
45
"""Available post processors include linuxcnc, grbl and opensbp."""
46
posts = Path.Preferences.allAvailablePostProcessors()
47
self.assertTrue("linuxcnc" in posts)
48
self.assertTrue("grbl" in posts)
49
self.assertTrue("opensbp" in posts)
52
"""Default paths for tools are resolved correctly"""
54
self.assertTrue(Path.Preferences.pathDefaultToolsPath().endswith("/CAM/Tools/"))
55
self.assertTrue(Path.Preferences.pathDefaultToolsPath("Bit").endswith("/CAM/Tools/Bit"))
57
Path.Preferences.pathDefaultToolsPath("Library").endswith("/CAM/Tools/Library")
60
Path.Preferences.pathDefaultToolsPath("Template").endswith("/CAM/Tools/Template")