File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarAssets Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,31 @@ public class WearableItemShould
88 {
99 private const string BODY_SHAPE = "male" ;
1010
11+ [ Test ]
12+ public void WearableCantHideItself ( )
13+ {
14+ var wearable = new WearableItem
15+ {
16+ data = new WearableItem . Data
17+ {
18+ category = WearableLiterals . Categories . UPPER_BODY ,
19+ representations = new [ ]
20+ {
21+ new WearableItem . Representation
22+ {
23+ bodyShapes = new [ ] { BODY_SHAPE } ,
24+ overrideHides = new [ ] { WearableLiterals . Categories . UPPER_BODY }
25+ }
26+ } ,
27+ hides = new [ ] { WearableLiterals . Categories . UPPER_BODY }
28+ }
29+ } ;
30+
31+ string [ ] hides = wearable . GetHidesList ( BODY_SHAPE ) ;
32+
33+ Assert . IsTrue ( ! hides . Contains ( WearableLiterals . Categories . UPPER_BODY ) , "Wearable does not contain its own category" ) ;
34+ }
35+
1136 [ Test ]
1237 public void GetHideCategoriesWhenIsSkin ( )
1338 {
Original file line number Diff line number Diff line change @@ -247,6 +247,9 @@ public string[] GetHidesList(string bodyShapeType)
247247 if ( replaces != null )
248248 hides . UnionWith ( replaces ) ;
249249
250+ // Safeguard so no wearable can hide itself
251+ hides . Remove ( data . category ) ;
252+
250253 return hides . ToArray ( ) ;
251254 }
252255
You can’t perform that action at this time.
0 commit comments