/* Ċ Ġ* ĠCopyright Ġ( c ) ĠMeta ĠPlatform s , ĠInc . Ġand Ġaffiliates . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ Ċ package Ġcom . facebook . l ith o . animated Ċ Ċ import Ġandroid . graphics . Color Ċ import Ġandroid . graphics . drawable . Color Drawable Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġcom . facebook . l ith o . Dynamic Value Ċ import Ġcom . facebook . l ith o . Row Ċ import Ġcom . facebook . l ith o . Style Ċ import Ġcom . facebook . l ith o . core . height Ċ import Ġcom . facebook . l ith o . core . width Ċ import Ġcom . facebook . l ith o . px Ċ import Ġcom . facebook . l ith o . testing . Legacy L ith o View Rule Ċ import Ġcom . facebook . l ith o . testing . set Root Ċ import Ġcom . facebook . l ith o . testing . un specified Ċ import Ġcom . facebook . l ith o . view . background Ċ import Ġorg . assertj . core . api . Java 6 Assertions . assertThat Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ /** ĠUnit Ġtests Ġfor Ġcommon Ġstyles Ġdefined Ġin Ġ[ Dynamic Value Styles ]. Ġ*/ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠDynamic Value Styles Test Ġ{ ĊĊĠ Ġ@ Rule Ġ@ Jvm Field Ġval Ġl ith o View Rule Ġ= ĠLegacy L ith o View Rule () ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġdynamic _ backgroundColor _ when Set _ is Res pect ed () Ġ{ ĊĠĠĠ Ġval Ġstart Value : ĠInt Ġ= ĠColor . RED ĊĠĠĠ Ġval ĠbackgroundColor DV : ĠDynamic Value < Int > Ġ= ĠDynamic Value < Int >( start Value ) ĊĊĠĠĠ Ġl ith o View Rule ĊĠĠĠĠĠĠĠ Ġ. setSize Specs ( un specified (), Ġunspecified ()) ĊĠĠĠĠĠĠĠ Ġ. set Root Ġ{ ĊĠĠĠĠĠĠĠĠĠ ĠRow ( style Ġ= ĠStyle . width ( 1 0 0 . px ). height ( 1 0 0 . px ). backgroundColor ( backgroundColor DV )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ. measure () ĊĠĠĠĠĠĠĠ Ġ. layout () ĊĠĠĠĠĠĠĠ Ġ. attach To Window () ĊĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . background ). isInstanceOf ( Color Drawable :: class . java ) ĊĠĠĠ ĠassertThat (( l ith o View Rule . l ith o View . background Ġas ĠColor Drawable ). color ). isEqualTo ( Color . RED ) ĊĊĠĠĠ ĠbackgroundColor DV . set ( Color . WHITE ) ĊĠĠĠ ĠassertThat (( l ith o View Rule . l ith o View . background Ġas ĠColor Drawable ). color ). isEqualTo ( Color . WHITE ) ĊĊĠĠĠ ĠbackgroundColor DV . set ( Color . TRANSP ARENT ) ĊĠĠĠ ĠassertThat (( l ith o View Rule . l ith o View . background Ġas ĠColor Drawable ). color ) ĊĠĠĠĠĠĠĠ Ġ. isEqualTo ( Color . TRANSP ARENT ) ĊĠ Ġ} ĊĠ Ġfun Ġdynamic _ alpha _ when Set _ is Res pect ed () Ġ{ ĊĠĠĠ Ġval Ġalpha Ġ= Ġ 0 . 5 f ĊĠĠĠ Ġval Ġalpha DV : ĠDynamic Value < Float > Ġ= ĠDynamic Value < Float >( alpha ) ĊĊĠĠĠ Ġl ith o View Rule ĊĠĠĠĠĠĠĠ Ġ. setSize Specs ( un specified (), Ġunspecified ()) ĊĠĠĠĠĠĠĠ Ġ. set Root Ġ{ ĠRow ( style Ġ= ĠStyle . width ( 1 0 0 . px ). height ( 1 0 0 . px ). alpha ( alpha DV )) Ġ} ĊĠĠĠĠĠĠĠ Ġ. measure () ĊĠĠĠĠĠĠĠ Ġ. layout () ĊĠĠĠĠĠĠĠ Ġ. attach To Window () ĊĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . alpha ). isEqualTo ( alpha ) ĊĊĠĠĠ Ġalpha DV . set ( 1 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . alpha ). isEqualTo ( 1 f ) ĊĠĠĠ Ġalpha DV . set ( 0 . 7 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . alpha ). isEqualTo ( 0 . 7 f ) ĊĠ Ġ} ĊĊĠ Ġfun Ġdynamic _ translation _ when Set _ is Res pect ed () Ġ{ ĊĠĠĠ Ġval Ġtranslation X DV : ĠDynamic Value < Float > Ġ= ĠDynamic Value < Float >( 1 0 f ) ĊĠĠĠ Ġval Ġtranslation Y DV : ĠDynamic Value < Float > Ġ= ĠDynamic Value < Float >( 1 0 f ) ĊĊĠĠĠ Ġl ith o View Rule ĊĠĠĠĠĠĠĠ Ġ. setSize Specs ( un specified (), Ġunspecified ()) ĊĠĠĠĠĠĠĠ Ġ. set Root Ġ{ ĊĠĠĠĠĠĠĠĠĠ ĠRow ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġstyle Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠStyle . width ( 1 0 0 . px ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. height ( 1 0 0 . px ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. translation X ( translation X DV ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. translation Y ( translation Y DV )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ. measure () ĊĠĠĠĠĠĠĠ Ġ. layout () ĊĠĠĠĠĠĠĠ Ġ. attach To Window () ĊĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . translation X ). isEqualTo ( 1 0 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . translation Y ). isEqualTo ( 1 0 f ) ĊĊĠĠĠ Ġtranslation X DV . set (- 5 0 f ) ĊĠĠĠ Ġtranslation Y DV . set ( 2 0 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . translation X ). isEqualTo (- 5 0 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . translation Y ). isEqualTo ( 2 0 f ) ĊĊĠĠĠ Ġtranslation X DV . set ( 3 5 f ) ĊĠĠĠ Ġtranslation Y DV . set (- 7 5 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . translation X ). isEqualTo ( 3 5 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . translation Y ). isEqualTo (- 7 5 f ) ĊĠ Ġ} ĊĊĠ Ġfun Ġdynamic _ rotation _ when Set _ is Res pect ed () Ġ{ ĊĠĠĠ Ġval Ġrotation DV : ĠDynamic Value < Float > Ġ= ĠDynamic Value < Float >( 1 0 f ) ĊĊĠĠĠ Ġl ith o View Rule ĊĠĠĠĠĠĠĠ Ġ. setSize Specs ( un specified (), Ġunspecified ()) ĊĠĠĠĠĠĠĠ Ġ. set Root Ġ{ ĠRow ( style Ġ= ĠStyle . width ( 1 0 0 . px ). height ( 1 0 0 . px ). rotation ( rotation DV )) Ġ} ĊĠĠĠĠĠĠĠ Ġ. measure () ĊĠĠĠĠĠĠĠ Ġ. layout () ĊĠĠĠĠĠĠĠ Ġ. attach To Window () ĊĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . rotation ). isEqualTo ( 1 0 f ) ĊĊĠĠĠ Ġrotation DV . set (- 3 5 0 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . rotation ). isEqualTo (- 3 5 0 f ) ĊĊĠĠĠ Ġrotation DV . set ( 0 . 5 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . rotation ). isEqualTo ( 0 . 5 f ) ĊĠ Ġ} ĊĊĠ Ġfun Ġdynamic _ scale _ when Set _ is Res pect ed () Ġ{ ĊĠĠĠ Ġval Ġscale X DV : ĠDynamic Value < Float > Ġ= ĠDynamic Value < Float >( 1 0 f ) ĊĠĠĠ Ġval Ġscale Y DV : ĠDynamic Value < Float > Ġ= ĠDynamic Value < Float >( 1 0 f ) ĊĊĠĠĠ Ġl ith o View Rule ĊĠĠĠĠĠĠĠ Ġ. setSize Specs ( un specified (), Ġunspecified ()) ĊĠĠĠĠĠĠĠ Ġ. set Root Ġ{ ĊĠĠĠĠĠĠĠĠĠ ĠRow ( style Ġ= ĠStyle . width ( 1 0 0 . px ). height ( 1 0 0 . px ). scale X ( scale X DV ). scale Y ( scale Y DV )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ. measure () ĊĠĠĠĠĠĠĠ Ġ. layout () ĊĠĠĠĠĠĠĠ Ġ. attach To Window () ĊĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . scale X ). isEqualTo ( 1 0 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . scale Y ). isEqualTo ( 1 0 f ) ĊĊĠĠĠ Ġscale X DV . set (- 5 0 f ) ĊĠĠĠ Ġscale Y DV . set ( 2 0 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . scale X ). isEqualTo (- 5 0 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . scale Y ). isEqualTo ( 2 0 f ) ĊĊĠĠĠ Ġscale X DV . set ( 0 . 5 f ) ĊĠĠĠ Ġscale Y DV . set ( 0 . 7 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . scale X ). isEqualTo ( 0 . 5 f ) ĊĠĠĠ ĠassertThat ( l ith o View Rule . l ith o View . scale Y ). isEqualTo ( 0 . 7 f ) ĊĠ Ġ} Ċ } Ċ