File: test_create_project.py

package info (click to toggle)
librepcb 1.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,488 kB
  • sloc: cpp: 267,986; python: 12,100; ansic: 6,899; xml: 234; sh: 215; makefile: 115; perl: 73
file content (35 lines) | stat: -rw-r--r-- 1,357 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Test creating projects
"""

import os


def test_new_project_wizard(librepcb):
    """
    Create project using the wizard from the control panel
    """
    with librepcb.open() as app:
        # Open new project wizard
        app.widget('controlPanelNewProjectButton').click()
        assert app.widget('controlPanelNewProjectWizard').properties()['visible'] is True
        # Enter metadata
        name = 'New Project'
        app.widget('controlPanelNewProjectWizardMetadataNameEdit').set_property('text', name)
        path = app.widget('controlPanelNewProjectWizardMetadataPathEdit').properties()['text']
        app.widget('controlPanelNewProjectWizardNextButton').click()
        # Setup schematic/board
        app.widget('controlPanelNewProjectWizardFinishButton').click()
        # Verify if editors are opened and project file exists
        assert app.widget('schematicEditor').properties()['visible'] is True
        assert app.widget('boardEditor').properties()['visible'] is True
        assert os.path.exists(path)

    # Open project again to see if it was saved properly
    librepcb.set_project(path)
    with librepcb.open() as app:
        assert app.widget('schematicEditor').properties()['visible'] is True
        assert app.widget('boardEditor').properties()['visible'] is True