tests: Add test for MovieClip.getBounds

This commit is contained in:
Mike Welsh 2020-02-20 18:25:26 -08:00
parent 8018c88870
commit 73a9a0e771
4 changed files with 87 additions and 1 deletions

View File

@ -178,11 +178,13 @@ swf_tests! {
} }
// TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough. // TODO: These tests have some inaccuracies currently, so we use approx_eq to test that numeric values are close enough.
// Eventually we can hopefully make these match exactly (see #193). // Eventually we can hopefully make some of these match exactly (see #193).
// Some will probably always need to be approx. (if they rely on trig functions, etc.)
swf_tests_approx! { swf_tests_approx! {
(local_to_global, "avm1/local_to_global", 1, 0.4), (local_to_global, "avm1/local_to_global", 1, 0.4),
(stage_object_properties, "avm1/stage_object_properties", 4, 0.051), (stage_object_properties, "avm1/stage_object_properties", 4, 0.051),
(stage_object_properties_swf6, "avm1/stage_object_properties_swf6", 4, 0.051), (stage_object_properties_swf6, "avm1/stage_object_properties_swf6", 4, 0.051),
(movieclip_getbounds, "avm1/movieclip_getbounds", 1, 0.1),
} }
#[test] #[test]

View File

@ -0,0 +1,84 @@
// clip.clip.getBounds()
-50
-112
154.95
50
// clip.clip.getBounds(clip.clip)
-50
-112
154.95
50
// clip.clip.getBounds(clip.clip)
-50
-112
154.95
50
// clip.clip.getBounds(clip.clip.clip)
-154.95
-100
50
471.9
// clip.clip.getBounds(clip)
-35.35
-57.25
94.4
72.5
// clip.clip.getBounds(_root)
99.95
100
261.95
304.95
// clip.clip.getBounds(clip2)
-124.65
210.05
145.75
469.5
// clip.getBounds('/')
3.5
50
308.4
354.9
// clip.getBounds('/clip')
-35.35
-35.35
76.7
68.2
// clip.getBounds('clip:clip')
-204.95
-99.9
99.95
521.9
// clip3.getBounds(undefined)
-119.8
-89.8
50
68
// clip3.getBounds(o)
-5.8
-107.8
164
50
// clip.clip.getBounds(undefined)
undefined
// clip.clip.getBounds(undefined)
undefined
// clip.getBounds('')
undefined
// clip.clip.getBounds('clip.clip')
undefined

Binary file not shown.

Binary file not shown.