Example #1
0
def test_get_build_environment():
    class Options:
        qmake_parameters = list()
        qmake_project_file = ""

    plugin = QMakePlugin(part_name="my-part", options=Options())

    assert plugin.get_build_environment() == {"QT_SELECT": "qt5"}
Example #2
0
def test_get_build_snaps():
    class Options:
        qmake_parameters = list()
        qmake_project_file = ""

    plugin = QMakePlugin(part_name="my-part", options=Options())

    assert plugin.get_build_snaps() == set()
Example #3
0
def test_get_build_packages():
    class Options:
        qmake_parameters = list()
        qmake_project_file = ""

    plugin = QMakePlugin(part_name="my-part", options=Options())

    assert plugin.get_build_packages() == {"g++", "make", "qt5-qmake"}
Example #4
0
def test_get_build_commands_with_qmake_parameters():
    class Options:
        qmake_parameters = ["-Wall"]
        qmake_project_file = ""

    plugin = QMakePlugin(part_name="my-part", options=Options())

    assert plugin.get_build_commands() == [
        'qmake QMAKE_CFLAGS+="${CFLAGS:-}" QMAKE_CXXFLAGS+="${CXXFLAGS:-}" QMAKE_LFLAGS+="${LDFLAGS:-}" -Wall "${SNAPCRAFT_PART_SRC_WORK}"',
        'env -u CFLAGS -u CXXFLAGS make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"',
        'make install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"',
    ]
Example #5
0
def test_out_of_source_build():
    class Options:
        qmake_parameters = list()
        qmake_project_file = ""

    plugin = QMakePlugin(part_name="my-part", options=Options())

    assert plugin.out_of_source_build is True
Example #6
0
def test_schema():
    assert QMakePlugin.get_schema() == {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "additionalProperties": False,
        "properties": {
            "qmake-parameters": {
                "type": "array",
                "uniqueItems": True,
                "items": {
                    "type": "string"
                },
                "default": [],
            },
            "qmake-project-file": {
                "type": "string",
                "default": ""
            },
        },
    }