@@ -28,18 +28,19 @@ def test_get_size_from_css(mocker):
28
28
}
29
29
"""
30
30
mocker .patch ("napari.qt.get_current_stylesheet" ).return_value = test_css
31
- assert from_css_get_size_of ("Flibble" , (1 , 1 )) == QSize (123 , 456 )
31
+ assert from_css_get_size_of ("Flibble" , (1 , 2 )) == QSize (123 , 456 )
32
32
33
33
34
34
def test_fallback_if_missing_dimensions (mocker ):
35
35
"""Test fallback if given something that doesn't have dimensions"""
36
36
test_css = " Flobble { background-color: rgb(0, 97, 163); } "
37
37
mocker .patch ("napari.qt.get_current_stylesheet" ).return_value = test_css
38
- assert from_css_get_size_of ("Flobble" , (1 , 1 )) == QSize (1 , 1 )
38
+ with pytest .warns (RuntimeWarning , match = "Unable to find DimensionToken" ):
39
+ assert from_css_get_size_of ("Flobble" , (1 , 2 )) == QSize (1 , 2 )
39
40
40
41
41
42
def test_fallback_if_prelude_not_in_css ():
42
43
"""Test fallback if given something not in the css"""
43
- assert from_css_get_size_of ( "AQButtonThatDoesntExist" , ( 1 , 1 )) == QSize (
44
- 1 , 1
45
- )
44
+ doesntexist = "AQButtonThatDoesntExist"
45
+ with pytest . warns ( RuntimeWarning , match = f"Unable to find { doesntexist } " ):
46
+ assert from_css_get_size_of ( doesntexist , ( 1 , 2 )) == QSize ( 1 , 2 )
0 commit comments