aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py2
-rw-r--r--tests/data/config/projects/testproject.avp (renamed from tests/data/projects/testproject.avp)6
-rw-r--r--tests/test_core_init.py13
-rw-r--r--tests/test_mainwindow_projects.py12
4 files changed, 28 insertions, 5 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index df08c7c..bb35f72 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -43,7 +43,7 @@ def getTestDataPath(filename=""):
def initCore():
- testDataDir = getTestDataPath()
+ testDataDir = getTestDataPath("config")
unwanted = ["autosave.avp", "settings.ini"]
for file in unwanted:
filename = os.path.join(testDataDir, "autosave.avp")
diff --git a/tests/data/projects/testproject.avp b/tests/data/config/projects/testproject.avp
index fd6b6eb..9639716 100644
--- a/tests/data/projects/testproject.avp
+++ b/tests/data/config/projects/testproject.avp
@@ -9,9 +9,9 @@ OrderedDict({'LG_end': 0.0, 'LG_start': 0.0, 'RG_centre': 0.0015625, 'RG_end': 0
[Settings]
componentDir=tests/data/inputfiles
inputDir=tests/data/inputfiles
-presetDir=tests/data/presets
-projectDir=tests/data/projects
+presetDir=tests/data/config/presets
+projectDir=tests/data/config/projects
[WindowFields]
-lineEdit_audioFile=tests/data/test.ogg
+lineEdit_audioFile=tests/data/inputfiles/test.ogg
lineEdit_outputFile=
diff --git a/tests/test_core_init.py b/tests/test_core_init.py
index 16606fb..e1f2dbb 100644
--- a/tests/test_core_init.py
+++ b/tests/test_core_init.py
@@ -1,7 +1,10 @@
+import os
from avp.core import Core
+from . import getTestDataPath, initCore
def test_component_names():
+ initCore()
core = Core()
assert core.compNames == [
"Classic Visualizer",
@@ -17,5 +20,15 @@ def test_component_names():
def test_moduleindex():
+ initCore()
core = Core()
assert core.moduleIndexFor("Classic Visualizer") == 0
+
+
+def test_configPath_default():
+ configPath = Core.getConfigPath(None)
+ assert os.path.basename(configPath) == "audio-visualizer"
+
+
+def test_configPath_nonstandard():
+ assert Core.getConfigPath(getTestDataPath("config")) == getTestDataPath("config")
diff --git a/tests/test_mainwindow_projects.py b/tests/test_mainwindow_projects.py
index 8ad491a..6b49799 100644
--- a/tests/test_mainwindow_projects.py
+++ b/tests/test_mainwindow_projects.py
@@ -1,3 +1,5 @@
+from PyQt6 import QtCore
+import os
from pytest import fixture
from pytestqt import qtbot
from . import getTestDataPath, window
@@ -8,9 +10,17 @@ def test_mainwindow_clear(qtbot, window):
assert len(window.core.selectedComponents) == 0
+def test_mainwindow_presetDir_in_tests(qtbot, window):
+ # FIXME presetDir gets set to projectDir for some reason
+ assert (
+ os.path.basename(os.path.dirname(window.core.settings.value("presetDir")))
+ == "config"
+ )
+
+
def test_mainwindow_openProject(qtbot, window):
"""Open testproject.avp using MainWindow.openProject()"""
- window.openProject(getTestDataPath("projects/testproject.avp"), prompt=False)
+ window.openProject(getTestDataPath("config/projects/testproject.avp"), prompt=False)
assert len(window.core.selectedComponents) == 2