1from PyQt5.QtCore import QUrl 2 3from UM.Stage import Stage 4 5 6def test_addGetDisplayComponent(): 7 stage = Stage() 8 stage.addDisplayComponent("BLORP", "location") 9 assert stage.getDisplayComponent("BLORP") == QUrl.fromLocalFile("location") 10 11 stage.addDisplayComponent("MEEP!", QUrl.fromLocalFile("MEEP")) 12 assert stage.getDisplayComponent("MEEP!") == QUrl.fromLocalFile("MEEP") 13 14 15def test_iconSource(): 16 stage = Stage() 17 18 # Should be empty if we didn't do anything yet 19 assert stage.iconSource == QUrl() 20 21 stage.setIconSource("DERP") 22 assert stage.iconSource == QUrl.fromLocalFile("DERP") 23 24 stage.setIconSource(QUrl.fromLocalFile("FOO")) 25 assert stage.iconSource == QUrl.fromLocalFile("FOO") 26 27 28def test_getUnknownDisplayComponent(): 29 stage = Stage() 30 # Just an empty QUrl 31 assert stage.getDisplayComponent("BLORP") == QUrl()