package Ġme . h uf man . android aut oid rive . music Ċ Ċ import Ġandroid . graphics . Bitmap Ċ import Ġandroid . graphics . drawable . Drawable Ċ import Ġandroid . os . Handler Ċ import Ġandroid . os . Looper Ċ import Ġcom . n ha ar man . mockito _ kotlin .* Ċ import Ġde . bm w . id rive . BM WR em oting Ċ import Ġde . bm w . id rive . BM WR em oting Client Ċ import Ġkotlinx . coroutines .* Ċ import Ġme . h uf man . android aut oid rive .* Ċ import Ġme . h uf man . android aut oid rive . car app . RH MI Action Abort Ċ import Ġme . h uf man . android aut oid rive . car app . music .* Ċ import Ġme . h uf man . android aut oid rive . car app . music . components . Progress Gauge Audio State Ċ import Ġme . h uf man . android aut oid rive . car app . music . components . Progress Gauge Toolbar State Ċ import Ġme . h uf man . android aut oid rive . car app . music . views .* Ċ import Ġme . h uf man . android aut oid rive . music . controllers . Music App Controller Ċ import Ġme . h uf man . android aut oid rive . utils . Graphics Helpers Ċ import Ġme . h uf man . id rive connection kit . ID rive Connection Ċ import Ġme . h uf man . id rive connection kit . android . Car App Resources Ċ import Ġme . h uf man . id rive connection kit . android . ID rive Connection Status Ċ import Ġme . h uf man . id rive connection kit . android . security . Security Access Ċ import Ġme . h uf man . id rive connection kit . rh mi .* Ċ import Ġorg . await ility . Await ility . await Ċ import Ġorg . junit . Assert .* Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġjava . io . ByteArray InputStream Ċ import Ġjava . nio . charset . Charset Ċ import Ġjava . util .* Ċ Ċ class ĠMusic App Test Ġ{ Ċ ĉ object ĠIDs Ġ{ Ċĉ ĉ const Ġval ĠF OC US _ EVENT Ġ= Ġ 6 Ċĉ ĉ const Ġval ĠEN TRY BUTTON _ ACTION Ġ= Ġ 3 8 2 Ċĉ ĉ const Ġval ĠEN TRY BUTTON _ DEST _ STATE Ġ= Ġ 3 8 4 Ċĉ ĉ const Ġval ĠAPP LIST _ STATE Ġ= Ġ 9 Ċĉ ĉ const Ġval ĠAPP LIST _ ID 5 _ STATE Ġ= Ġ 1 1 Ċĉ ĉ const Ġval ĠAPP LIST _ TEXT MODEL Ġ= Ġ 3 9 0 Ċĉ ĉ const Ġval ĠAPP LIST _ COMPONENT Ġ= Ġ 2 7 Ċĉ ĉ const Ġval ĠAPP LIST _ LIST MODEL Ġ= Ġ 3 9 4 Ċĉ ĉ const Ġval ĠAPP LIST _ ACTION Ġ= Ġ 1 6 5 ĊĊĉ ĉ const Ġval ĠNOT IFICATION ICON _ EVENT Ġ= Ġ 5 Ċĉ ĉ const Ġval ĠMUL TIME DI A _ EVENT Ġ= Ġ 5 7 6 Ċĉ ĉ const Ġval ĠSTAT USB AR _ EVENT Ġ= Ġ 5 7 7 Ċĉ ĉ const Ġval ĠGLOBAL _ IMAGE ID _ MODEL Ġ= Ġ 5 6 5 Ċĉ ĉ const Ġval ĠGLOBAL _ AR TI ST _ MODEL Ġ= Ġ 5 6 9 Ċĉ ĉ const Ġval ĠGLOBAL _ TRACK _ MODEL Ġ= Ġ 5 7 0 Ċĉ ĉ const Ġval ĠGLOBAL _ APP _ MODEL Ġ= Ġ 5 7 1 Ċĉ ĉ const Ġval ĠIC _ TRACK _ MODEL Ġ= Ġ 5 3 9 Ċĉ ĉ const Ġval ĠIC _ PLAY LIST _ MODEL Ġ= Ġ 5 3 4 Ċĉ ĉ const Ġval ĠIC _ TRACK _ ACTION Ġ= Ġ 3 6 5 Ċĉ ĉ const Ġval ĠIC _ USE CASE _ MODEL Ġ= Ġ 5 3 5 Ċĉ ĉ const Ġval ĠIMAGE ID _ AUDIO Ġ= Ġ 1 6 1 Ċĉ ĉ const Ġval ĠIMAGE ID _ SH UFF LE _ ON Ġ= Ġ 1 5 1 Ċĉ ĉ const Ġval ĠIMAGE ID _ SH UFF LE _ OFF Ġ= Ġ 1 5 8 ĊĊĉ ĉ const Ġval ĠP LAY BACK _ STATE Ġ= Ġ 1 6 Ċĉ ĉ const Ġval ĠAPP ICON _ MODEL Ġ= Ġ 4 7 0 Ċĉ ĉ const Ġval ĠCO VER ART _ LARGE _ COMPONENT Ġ= Ġ 8 9 Ċĉ ĉ const Ġval ĠCO VER ART _ LARGE _ MODEL Ġ= Ġ 4 6 9 Ċĉ ĉ const Ġval ĠCO VER ART _ SMALL _ COMPONENT Ġ= Ġ 1 0 0 Ċĉ ĉ const Ġval ĠCO VER ART _ SMALL _ MODEL Ġ= Ġ 4 7 3 Ċĉ ĉ const Ġval ĠAR TI ST _ LARGE _ MODEL Ġ= Ġ 4 7 7 Ċĉ ĉ const Ġval ĠAR TI ST _ SMALL _ MODEL Ġ= Ġ 4 8 6 Ċĉ ĉ const Ġval ĠAL BU M _ LARGE _ MODEL Ġ= Ġ 4 7 8 Ċĉ ĉ val ĠAL BU M _ SMALL _ MODEL Ġ= Ġnull Ċĉ ĉ const Ġval ĠTR ACK _ LARGE _ MODEL Ġ= Ġ 4 7 9 Ċĉ ĉ const Ġval ĠTR ACK _ SMALL _ MODEL Ġ= Ġ 4 8 8 Ċĉ ĉ const Ġval ĠTIME _ NUMBER _ LARGE _ MODEL Ġ= Ġ 4 8 0 Ċĉ ĉ const Ġval ĠTIME _ NUMBER _ SMALL _ MODEL Ġ= Ġ 4 9 0 Ċĉ ĉ const Ġval ĠTIME _ G AU GE _ MODEL Ġ= Ġ 4 6 8 Ċĉ ĉ const Ġval ĠMAX TIME _ NUMBER _ LARGE _ MODEL Ġ= Ġ 4 8 1 Ċĉ ĉ const Ġval ĠMAX TIME _ NUMBER _ SMALL _ MODEL Ġ= Ġ 4 9 1 ĊĊĉ ĉ const Ġval ĠTO OL BAR _ QUEUE _ BUTTON Ġ= Ġ 1 1 3 Ċĉ ĉ const Ġval ĠQ UE UE _ STATE Ġ= Ġ 1 9 Ċĉ ĉ const Ġval ĠQ UE UE _ ID 5 _ STATE Ġ= Ġ 1 2 Ċĉ ĉ const Ġval ĠQ UE UE _ STATE _ TEXT _ MODEL Ġ= Ġ 5 2 6 Ċĉ ĉ const Ġval ĠQ UE UE _ LIST _ COMPONENT Ġ= Ġ 1 3 3 Ċĉ ĉ const Ġval ĠQ UE UE _ IMAGE _ COMPONENT Ġ= Ġ 1 3 2 Ċĉ ĉ const Ġval ĠQ UE UE _ LIST _ MODEL Ġ= Ġ 5 3 2 Ċĉ ĉ const Ġval ĠQ UE UE _ IMAGE _ MODEL Ġ= Ġ 5 3 1 Ċĉ ĉ const Ġval ĠQ UE UE _ TITLE _ MODEL Ġ= Ġ 5 2 7 Ċĉ ĉ const Ġval ĠQ UE UE _ TITLE _ COMPONENT Ġ= Ġ 1 3 5 Ċĉ ĉ const Ġval ĠQ UE UE _ SUB TITLE _ MODEL Ġ= Ġ 5 2 8 Ċĉ ĉ const Ġval ĠQ UE UE _ SUB TITLE _ COMPONENT Ġ= Ġ 1 3 6 ĊĊĉ ĉ const Ġval ĠTO OL BAR _ ACTION _ BUTTON Ġ= Ġ 1 1 5 Ċĉ ĉ const Ġval ĠACTION _ STATE Ġ= Ġ 2 1 Ċĉ ĉ const Ġval ĠACTION _ ID 5 _ STATE Ġ= Ġ 1 8 Ċĉ ĉ const Ġval ĠACTION _ LIST _ COMPONENT Ġ= Ġ 1 4 1 Ċĉ ĉ const Ġval ĠACTION _ LIST _ MODEL Ġ= Ġ 5 4 9 ĊĊĉ ĉ const Ġval ĠB ROW SE 1 _ STATE Ġ= Ġ 1 1 Ċĉ ĉ const Ġval ĠB ROW SE 1 _ STATE _ MODEL Ġ= Ġ 4 1 6 Ċĉ ĉ const Ġval ĠB ROW SE 1 _ LABEL _ COMPONENT Ġ= Ġ 4 8 Ċĉ ĉ const Ġval ĠB ROW SE 1 _ LABEL _ MODEL Ġ= Ġ 4 1 7 Ċĉ ĉ const Ġval ĠB ROW SE 1 _ ACTION S _ COMPONENT Ġ= Ġ 5 1 Ċĉ ĉ const Ġval ĠB ROW SE 1 _ ACTION S _ MODEL Ġ= Ġ 4 2 0 Ċĉ ĉ const Ġval ĠB ROW SE 1 _ M US IC _ COMPONENT Ġ= Ġ 5 3 Ċĉ ĉ const Ġval ĠB ROW SE 1 _ M US IC _ MODEL Ġ= Ġ 4 2 2 Ċĉ ĉ const Ġval ĠB ROW SE 2 _ STATE Ġ= Ġ 1 2 Ċĉ ĉ const Ġval ĠB ROW SE 2 _ LABEL _ COMPONENT Ġ= Ġ 6 0 Ċĉ ĉ const Ġval ĠB ROW SE 2 _ LABEL _ MODEL Ġ= Ġ 4 3 0 Ċĉ ĉ const Ġval ĠB ROW SE 2 _ M US IC _ COMPONENT Ġ= Ġ 6 5 Ċĉ ĉ const Ġval ĠB ROW SE 2 _ M US IC _ MODEL Ġ= Ġ 4 3 5 Ċĉ ĉ const Ġval ĠB ROW SE 3 _ STATE Ġ= Ġ 1 0 Ċĉ ĉ const Ġval ĠB ROW SE 3 _ M US IC _ MODEL Ġ= Ġ 4 0 9 Ċĉ ĉ const Ġval ĠB ROW SE 3 _ M US IC _ COMPONENT Ġ= Ġ 4 1 ĊĊĉ ĉ const Ġval ĠINPUT _ STATE Ġ= Ġ 1 7 Ċĉ ĉ const Ġval ĠINPUT _ COMPONENT Ġ= Ġ 1 1 9 Ċĉ ĉ const Ġval ĠINPUT _ RESULT _ MODEL Ġ= Ġ 5 1 2 Ċĉ ĉ const Ġval ĠINPUT _ SU G GEST _ MODEL Ġ= Ġ 5 0 9 ĊĊĉ ĉ const Ġval ĠA UDIO _ STATE Ġ= Ġ 2 4 Ċĉ ĉ const Ġval ĠA UDIO STATE _ TITLE _ MODEL Ġ= Ġ 4 4 4 Ċĉ ĉ const Ġval ĠA UDIO STATE _ PROVIDER _ MODEL Ġ= Ġ 4 5 7 Ċĉ ĉ const Ġval ĠA UDIO STATE _ COVER ART _ MODEL Ġ= Ġ 4 5 6 Ċĉ ĉ const Ġval ĠA UDIO STATE _ AR TI ST _ MODEL Ġ= Ġ 4 4 5 Ċĉ ĉ const Ġval ĠA UDIO STATE _ AL BU M _ MODEL Ġ= Ġ 4 4 6 Ċĉ ĉ const Ġval ĠA UDIO STATE _ TRACK _ MODEL Ġ= Ġ 4 4 7 Ċĉ ĉ const Ġval ĠA UDIO STATE _ CURRENT _ TIME _ MODEL Ġ= Ġ 4 5 1 Ċĉ ĉ const Ġval ĠA UDIO STATE _ MAX _ TIME _ MODEL Ġ= Ġ 4 5 2 Ċĉ ĉ const Ġval ĠA UDIO STATE _ PLAY BACK _ PROGRESS _ MODEL Ġ= Ġ 4 6 2 Ċĉ ĉ const Ġval ĠA UDIO STATE _ PLAY LIST _ MODEL Ġ= Ġ 4 5 8 Ċĉ ĉ const Ġval ĠA UDIO STATE _ PLAY LIST _ INDEX _ MODEL Ġ= Ġ 4 5 9 Ċ ĉ } ĊĊ ĉ val Ġhandler Ġ= Ġmock < Handler > Ġ{ Ċĉ ĉ on Ġ{ Ġlo oper Ġ} Ġdo Answer Ġ{ ĠL ooper . my Looper () Ġ} Ċ ĉ } ĊĊ ĉ val Ġi Drive Connection Status Ġ= Ġmock < ID rive Connection Status >() Ċ ĉ val Ġsecurity Access Ġ= Ġmock < Security Access > Ġ{ Ċĉ ĉ on Ġ{ Ġsign Challenge ( any (), Ġany () Ġ)} Ġdo Return ĠByteArray ( 5 1 2 ) Ċ ĉ } Ċ ĉ val Ġcar App Resources Ġ= Ġmock < Car App Resources > Ġ{ Ċĉ ĉ on Ġ{ Ġget App Certificate () Ġ} Ġdo Return ĠByteArrayInputStream ( ByteArray ( 0 )) Ċĉ ĉ on Ġ{ Ġget Ui Description () Ġ} Ġdo Answer Ġ{ Ġthis . java Class . class Loader !!. getResource AsStream (" ui _ description _ mult imedia _ v 2 . xml ") Ġ} Ċĉ ĉ on Ġ{ Ġget Images DB ( any ()) Ġ} Ġdo Return ĠByteArrayInputStream ( ByteArray ( 0 )) Ċĉ ĉ on Ġ{ Ġget Texts DB ( any ()) Ġ} Ġdo Return ĠByteArrayInputStream ( ByteArray ( 0 )) Ċ ĉ } ĊĊ ĉ val Ġphone App Resources Ġ= Ġmock < Phone App Resources > Ġ{ Ċĉ ĉ on Ġ{ Ġget AppName ( any ()) Ġ} Ġdo Return Ġ" Test ĠApp Name " Ċĉ ĉ on Ġ{ Ġget App Icon ( any ()) } Ġdo Return Ġmock < Drawable >() Ċĉ ĉ on Ġ{ Ġget Icon Drawable ( any ()) } Ġdo Return Ġmock < Drawable >() Ċ ĉ } ĊĊ ĉ val Ġgraphics Helpers Ġ= Ġmock < Graphics Helpers > Ġ{ Ċĉ ĉ on Ġ{ Ġis Dark ( any ()) Ġ} Ġdo Return Ġfalse Ċĉ ĉ on Ġ{ Ġcompress ( is A < Drawable >(), Ġany (), Ġany (), Ġany (), Ġany ()) Ġ} Ġdo Answer Ġ{" Drawable { ${ it . arguments [ 1 ]} x ${ it . arguments [ 2 ]}} ". toByteArray ()} Ċĉ ĉ on Ġ{ Ġcompress ( is A < Bitmap >(), Ġany (), Ġany (), Ġany (), Ġany ()) Ġ} Ġdo Answer Ġ{" Bitmap { ${ it . arguments [ 1 ]} x ${ it . arguments [ 2 ]}} ". toByteArray ()} Ċ ĉ } ĊĊ ĉ val Ġmusic App Discovery Ġ= Ġmock < Music App Discovery >() ĊĊ ĉ val Ġmusic Controller Ġ= Ġmock < Music Controller > Ġ{ Ċĉ ĉ on Ġ{ Ġget Metadata () Ġ} Ġdo Return ĠMusic Metadata (" test Id ", Ġqueue Id = 1 0 , Ċĉĉĉ ĉ duration = 1 8 0 0 0 0 L , Ċĉĉĉ ĉ icon = mock (), Ġcover Art = mock (), Ċĉĉĉ ĉ artist =" Artist ", Ġalbum =" Album ", Ġtitle =" Title ") Ċĉ ĉ on Ġ{ Ġget Playback Position () Ġ} Ġdo Return ĠPlay back Position ( false , Ġfalse , Ġ 0 , Ġ 5 0 0 0 L , Ġ 1 8 0 0 0 0 L ) Ċĉ ĉ on Ġ{ Ġis Supported Action ( any ()) Ġ} Ġdo Return Ġtrue Ċĉ ĉ on Ġ{ Ġis Supported Action ( Music Action . PLAY _ FROM _ SEARCH ) Ġ} Ġdo Return Ġfalse Ċĉ ĉ on Ġ{ Ġload Desired App () Ġ} Ġdo Return Ġ"" Ċĉ ĉ on Ġ{ Ġmusic Sessions Ġ} Ġdo Return Ġmock < Music Sessions >() Ċĉ ĉ on Ġ{ Ġis Connected () Ġ} Ġdo Return Ġtrue Ċ ĉ } ĊĊ ĉ val Ġinput State Ġ= Ġmock < RH MI State > Ġ{ Ċĉ ĉ on Ġ{ Ġcomponents List Ġ} Ġdo Answer Ġ{ Ċĉĉ ĉ mutable ListOf ( RH MI Component . Input ( mock (), ĠIDs . INPUT _ COMPONENT ). apply Ġ{ Ċĉĉĉ ĉ result Model Ġ= ĠIDs . INPUT _ RESULT _ MODEL Ċĉĉĉ ĉ suggest Model Ġ= ĠIDs . INPUT _ SU G GEST _ MODEL Ċĉĉ ĉ }) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ @ Before Ċ ĉ fun Ġsetup () Ġ{ Ċĉ ĉ AppSettings . load Default Settings () Ċĉ ĉ AppSettings . temp Set Setting ( AppSettings . KEYS . AUDIO _ FORCE _ CONTEXT , Ġ" true ") Ċĉ ĉ Unicode Clean er ._ add Placeholder Emoji ("\ uD 8 3 D \ u DC 0 8 ", ĠlistOf (" cat 2 "), Ġ" cat ") Ċĉ ĉ Unicode Clean er ._ add Placeholder Emoji ("\ uD 8 3 D \ u DE 3 B ", ĠlistOf (" heart _ ey es _ cat "), Ġ" heart _ ey es _ cat ") Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest App Init () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ ID rive Connection . mock Remoting Server Ġ= Ġmock Server Ċĉ ĉ val Ġapp Ġ= ĠMusic App ( i Drive Connection Status , Ġsecurity Access , Ġcar App Resources , ĠMusic Image IDs Mult imedia , Ġphone App Resources , Ġgraphics Helpers , Ġmusic App Discovery , Ġmusic Controller , Ġmock ()) ĊĊĉ ĉ // Ġverify Ġthe Ġright Ġelements Ġare Ġselected Ċĉ ĉ test App Init Switch er ( app . app Switch er View ) Ċĉ ĉ test App Init Playback View ( app . playback View ) Ċĉ ĉ test App Init Enqueue View ( app . en queued View ) Ċĉ ĉ test App Init Custom Actions View ( app . custom Actions View ) Ċ ĉ } ĊĊ ĉ fun Ġtest App Init Switch er ( app Switch er View : ĠApp Switch er View ) Ġ{ Ċĉ ĉ assertEquals (" Apps ", Ġapp Switch er View . state . getText Model ()?. as Ra DataModel ()?. value ) Ċĉ ĉ assertEquals ( IDs . APP LIST _ COMPONENT , Ġapp Switch er View . list Apps . id ) Ċĉ ĉ assertEquals ( true , Ġapp Switch er View . list Apps . properties [ RH MI Property . Property Id . VISIBLE . id ]?. value ) Ċ ĉ } ĊĊ ĉ fun Ġtest App Init Playback View ( playback View : ĠPlay back View ) Ġ{ Ċĉ ĉ val Ġstate Ġ= Ġplayback View . state Ġas ĠR H MI State . Toolbar State Ċĉ ĉ assertNull ( playback View . repeat Button ) Ċĉ ĉ assertEquals ( IDs . APP LIST _ STATE , Ġstate . toolbar Components List [ 0 ]. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ assertEquals ( IDs . QUEUE _ STATE , Ġstate . toolbar Components List [ 2 ]. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ assertEquals ( IDs . ACTION _ STATE , Ġstate . toolbar Components List [ 4 ]. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ assertEquals ( IDs . APP ICON _ MODEL , Ġplayback View . app Logo Model !!. id ) Ċĉ ĉ assertEquals ( IDs . COVER ART _ LARGE _ MODEL , Ġplayback View . album Art Big Model . id ) Ċĉ ĉ assertEquals ( IDs . COVER ART _ SMALL _ MODEL , Ġplayback View . album Art Small Model ?. id ) Ċĉ ĉ assertEquals ( set Of ( IDs . AR TI ST _ LARGE _ MODEL , ĠIDs . AR TI ST _ SMALL _ MODEL ), Ġplayback View . artist Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . AL BU M _ LARGE _ MODEL , ĠIDs . AL BU M _ SMALL _ MODEL ), Ġplayback View . album Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . TRACK _ LARGE _ MODEL , ĠIDs . TRACK _ SMALL _ MODEL ), Ġplayback View . track Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . TIME _ NUMBER _ LARGE _ MODEL , ĠIDs . TIME _ NUMBER _ SMALL _ MODEL ), Ġplayback View . currentTime Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . MAX TIME _ NUMBER _ LARGE _ MODEL , ĠIDs . MAX TIME _ NUMBER _ SMALL _ MODEL ), Ġplayback View . maximum Time Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . TIME _ G AU GE _ MODEL ), Ġ( playback View . gauge Model Ġas ĠProgress Gauge Toolbar State ). model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( true , Ġplayback View . queue Toolbar Button . properties [ RH MI Property . Property Id . BOOK MARK ABLE . id ]?. value ) Ċĉ ĉ assertEquals ( true , Ġplayback View . custom ActionButton . properties [ RH MI Property . Property Id . BOOK MARK ABLE . id ]?. value ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest App Init Playback View ID 5 () Ġ{ Ċĉ ĉ wh enever ( car App Resources . get Ui Description ()). do Answer Ġ{ Ġthis . java Class . class Loader !!. getResource AsStream (" ui _ description _ mult imedia _ v 3 . xml ") Ġ} Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ ID rive Connection . mock Remoting Server Ġ= Ġmock Server Ċĉ ĉ val Ġapp Ġ= ĠMusic App ( i Drive Connection Status , Ġsecurity Access , Ġcar App Resources , ĠMusic Image IDs Spot ify , Ġphone App Resources , Ġgraphics Helpers , Ġmusic App Discovery , Ġmusic Controller , Ġmock ()) Ċĉ ĉ val Ġplayback View Ġ= Ġapp . playback View Ċĉ ĉ val Ġstate Ġ= Ġplayback View . state Ġas ĠR H MI State . Audio H mi State Ċĉ ĉ assertEquals ( IDs . AUDIO STATE _ TITLE _ MODEL , Ġplayback View . app Title Model . id ) Ċĉ ĉ assertEquals ( IDs . APP LIST _ ID 5 _ STATE , Ġstate . toolbar Components List [ 0 ]. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ assertEquals ( IDs . QUEUE _ ID 5 _ STATE , Ġstate . toolbar Components List [ 2 ]. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ assertNotNull ( playback View . repeat Button ) Ċĉ ĉ assertEquals ( IDs . ACTION _ ID 5 _ STATE , Ġstate . toolbar Components List [ 3 ]. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ assertNull ( playback View . app Logo Model ) Ċĉ ĉ assertEquals ( IDs . AUDIO STATE _ COVER ART _ MODEL , Ġplayback View . album Art Big Model . id ) Ċĉ ĉ assertEquals ( null , Ġplayback View . album Art Small Model ?. id ) Ċĉ ĉ assertEquals ( set Of ( IDs . AUDIO STATE _ AR TI ST _ MODEL ), Ġplayback View . artist Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . AUDIO STATE _ AL BU M _ MODEL ), Ġplayback View . album Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . AUDIO STATE _ TRACK _ MODEL ), Ġplayback View . track Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . AUDIO STATE _ CURRENT _ TIME _ MODEL ), Ġplayback View . currentTime Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( set Of ( IDs . AUDIO STATE _ MAX _ TIME _ MODEL ), Ġplayback View . maximum Time Model . members . map Ġ{ Ġit ?. id Ġ}. toSet ()) Ċĉ ĉ assertEquals ( IDs . AUDIO STATE _ PLAY BACK _ PROGRESS _ MODEL , Ġ( playback View . gauge Model Ġas ĠProgress Gauge Audio State ). model . id ) Ċĉ ĉ val Ġplaylist Ġ= Ġmock Server . data [ IDs . AUDIO STATE _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ĊĊĉ ĉ assertEquals ( 3 , Ġplaylist . total Rows ) Ċĉ ĉ assertEquals ( listOf (" Back ", Ġ"", Ġ" Next "), Ġplaylist . data . map Ġ{ Ġit [ 2 ] Ġ}) Ċĉ ĉ assertEquals ( false , Ġplaylist . data [ 1 ][ 0 ]) ĠĠĠĠĠĠĠ Ġ// Ġnot Ġanimated Ċĉ ĉ assertEquals ( 1 , Ġstate . get Play List Focus Row Model ()?. as Ra Int Model ()?. value ) ĊĊĉ ĉ // Ġtest Ġdisabled Ġbuttons Ġin Ġid 5 Ġaudio H mi State Ċĉ ĉ wh enever ( music Controller . is Supported Action ( Music Action . SET _ REPEAT _ MODE )) Ġdo Return Ġfalse Ċĉ ĉ wh enever ( music Controller . is Supported Action ( Music Action . SET _ SH UFF LE _ MODE )) Ġdo Return Ġfalse Ċĉ ĉ playback View . redraw () Ċĉ ĉ assertEquals (" Shuffle ĠUn available ", Ġplayback View . shuffle Button . get Tooltip Model ()?. as Ra DataModel ()?. value ) Ċĉ ĉ assertEquals (" Repeat ĠUn available ", Ġplayback View . repeat Button ?. get Tooltip Model ()?. as Ra DataModel ()?. value ) ĊĊĉ ĉ // Ġtest Ġbuffer ing Ġspinner Ċĉ ĉ wh enever ( music Controller . get Playback Position ()) Ġdo Return ĠPlay back Position ( false , Ġtrue , Ġ 0 , Ġ 5 0 0 0 L , Ġ 1 8 0 0 0 0 L ) Ċĉ ĉ playback View . redraw () Ċĉ ĉ val Ġloading Playlist Ġ= Ġmock Server . data [ IDs . AUDIO STATE _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( true , Ġloading Playlist . data [ 1 ][ 0 ]) ĠĠĠĠ Ġ// Ġanimated Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Playback View ID 5 Interaction () Ġ{ Ċĉ ĉ wh enever ( car App Resources . get Ui Description ()). do Answer Ġ{ Ġthis . java Class . class Loader !!. getResource AsStream (" ui _ description _ mult imedia _ v 3 . xml ") Ġ} Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ ID rive Connection . mock Remoting Server Ġ= Ġmock Server Ċĉ ĉ val Ġapp Ġ= ĠMusic App ( i Drive Connection Status , Ġsecurity Access , Ġcar App Resources , ĠMusic Image IDs Spot ify , Ġphone App Resources , Ġgraphics Helpers , Ġmusic App Discovery , Ġmusic Controller , Ġmock ()) Ċĉ ĉ val Ġstate Ġ= Ġapp . playback View . state Ġas ĠR H MI State . Audio H mi State Ċĉ ĉ state . toolbar Components List [ 4 ]. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 Ġto Ġtrue )) Ċĉ ĉ verify ( music Controller ). toggle Shuffle () Ċĉ ĉ state . toolbar Components List [ 5 ]. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 Ġto Ġtrue )) Ċĉ ĉ verify ( music Controller ). toggle Repeat () Ċĉ ĉ state . get Play List Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ verify ( music Controller , Ġtimes ( 1 )). skip To Previous () Ċĉ ĉ state . get Play List Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 1 )) Ċĉ ĉ verify ( music Controller ). seek To ( 0 ) Ċĉ ĉ state . get Play List Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 2 )) Ċĉ ĉ verify ( music Controller , Ġtimes ( 1 )). skip To Next () Ċ ĉ } ĊĊ ĉ fun Ġtest App Init Enqueue View ( en queued View : ĠEn queued View ) Ġ{ Ċĉ ĉ assertEquals ( IDs . QUEUE _ LIST _ COMPONENT , Ġen queued View . list Component . id ) Ċĉ ĉ assertEquals ( false , Ġen queued View . list Component . properties [ RH MI Property . Property Id . VALID . id ]?. value ) Ċĉ ĉ assertEquals ( true , Ġen queued View . list Component . properties [ RH MI Property . Property Id . VISIBLE . id ]?. value ) Ċĉ ĉ assertEquals (" 5 7 , 9 0 , 1 0 ,* ", Ġen queued View . list Component . properties [ RH MI Property . Property Id . LIST _ COLUMN WIDTH . id ]?. value ) Ċĉ ĉ assertEquals ( 1 8 0 , Ġen queued View . queue Image Component . properties [ RH MI Property . Property Id . WIDTH . id ]?. value ) Ċ ĉ } ĊĊ ĉ fun Ġtest App Init Custom Actions View ( custom Actions View : ĠCustom Actions View ) Ġ{ Ċĉ ĉ assertEquals ( IDs . ACTION _ LIST _ COMPONENT , Ġcustom Actions View . list Component . id ) Ċĉ ĉ assertEquals (" 5 7 , 0 ,* ", Ġcustom Actions View . list Component . properties [ RH MI Property . Property Id . LIST _ COLUMN WIDTH . id ]?. value ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest App Flow () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ ID rive Connection . mock Remoting Server Ġ= Ġmock Server Ċĉ ĉ val Ġmode Ġ= Ġmock < Music App Mode > Ġ{ Ċĉĉ ĉ on Ġ{ Ġshould Request Audio Context () Ġ} Ġdo Return Ġtrue Ċĉ ĉ } Ċĉ ĉ val Ġapp Ġ= ĠMusic App ( i Drive Connection Status , Ġsecurity Access , Ġcar App Resources , ĠMusic Image IDs Mult imedia , Ġphone App Resources , Ġgraphics Helpers , Ġmusic App Discovery , Ġmusic Controller , Ġmode ) Ċĉ ĉ val Ġmock Client Ġ= ĠID rive Connection . mock Remoting Client Ġas ĠBM WR em oting Client ĊĊĉ ĉ // Ġclick Ġinto Ġthe Ġtrigger Ġa Ġredraw Ċĉ ĉ mock Client . rh mi _ on ActionEvent ( 1 , Ġ" unused ", ĠIDs . ENTRY BUTTON _ ACTION , Ġmap Of ( 0 Ġto Ġ 1 )) Ċĉ ĉ mock Client . rh mi _ on H mi Event ( 1 , Ġ" unused ", ĠIDs . APP LIST _ STATE , Ġ 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) ĊĊĉ ĉ // Ġshows Ġthe Ġapp list Ġon Ġthe Ġfirst Ġclick Ġthrough Ċĉ ĉ println ( mock Server . properties ) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . APP LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . APP LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . SELECT ABLE . id ]) Ċĉ ĉ assertEquals ( IDs . APP LIST _ STATE , Ġmock Server . data [ IDs . ENTRY BUTTON _ DEST _ STATE ]) Ċĉ ĉ assertEquals (" Apps ", Ġmock Server . data [ IDs . APP LIST _ TEXT MODEL ]) Ċĉ ĉ assertArrayEquals ( array Of ( array Of ("", Ġ"", Ġ"< No ĠApps > ")), Ġ( mock Server . data [ IDs . APP LIST _ LIST MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data ) ĊĊĉ ĉ // Ġsome Ġapps Ġare Ġdiscovered Ċĉ ĉ wh enever ( music App Discovery . valid Apps ). do Answer Ġ{ Ċĉĉ ĉ listOf ( Music App Info (" Test 1 ", Ġmock (), Ġ" package ", Ġ" class "), Ċĉĉĉĉ ĉ Music App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class ")) Ċĉ ĉ } Ċĉ ĉ argument Captor < java . lang . Runnable >(). apply Ġ{ Ċĉĉ ĉ verify ( music App Discovery ). listener Ġ= Ġcapture () Ċĉĉ ĉ last Value . run () Ċĉĉ ĉ // Ġwithout Ġan ĠInstance ID , Ġwon 't Ġtry Ġto Ġcreate Ġan ĠAv Context Ċĉĉ ĉ assertEquals ( 0 , Ġmock Server . av Connections . size ) Ċĉĉ ĉ // Ġnow Ġset Ġthe Ġinstance Id Ċĉĉ ĉ wh enever ( i Drive Connection Status . instanceId ) Ġdo Return Ġ 9 Ċĉĉ ĉ last Value . run () Ċĉĉ ĉ assertEquals ( 1 , Ġmock Server . av Connections . size ) Ċĉ ĉ } ĊĊĉ ĉ // Ġclick Ġentry button Ġagain Ġwith Ġa Ġlist Ġof Ġapps Ċĉ ĉ mock Client . rh mi _ on ActionEvent ( 1 , Ġ" unused ", ĠIDs . ENTRY BUTTON _ ACTION , Ġmap Of ( 0 Ġto Ġ 1 )) Ċĉ ĉ mock Client . rh mi _ on H mi Event ( 1 , Ġ" unused ", ĠIDs . APP LIST _ STATE , Ġ 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . APP LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . SELECT ABLE . id ]) Ċĉ ĉ val Ġdisplayed Icons Ġ= Ġ( mock Server . data [ IDs . APP LIST _ LIST MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉ ĉ ( it [ 1 ] Ġas ĠBM WR em oting . RH MI Resource Data ). data Ċĉ ĉ } Ċĉ ĉ val Ġdisplayed Names Ġ= Ġ( mock Server . data [ IDs . APP LIST _ LIST MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉ ĉ it [ 2 ] Ċĉ ĉ } Ċĉ ĉ assertEquals (" Drawable { 4 8 x 4 8 }", Ġ( display ed Icons [ 0 ] Ġas ĠByteArray ). toString ( Charset . default Charset ())) Ċĉ ĉ assertEquals (" Drawable { 4 8 x 4 8 }", Ġ( display ed Icons [ 1 ] Ġas ĠByteArray ). toString ( Charset . default Charset ())) Ċĉ ĉ assertEquals ( listOf (" Test 1 ", Ġ" Test 2 "), Ġdisplayed Names ) ĊĊĉ ĉ // Ġtry Ġclicking Ġan Ġapp Ċĉ ĉ mock Client . rh mi _ on ActionEvent ( 1 , Ġ" unused ", ĠIDs . APP LIST _ ACTION , Ġmap Of ( 1 . to Byte () Ġto Ġ 1 )) Ċĉ ĉ assertEquals ( 0 , Ġmock Server . av Current Context ) Ċĉ ĉ mock Client . av _ connection Granted ( 0 , ĠBM WR em oting . AV Connection Type . AV _ CONNECTION _ TYPE _ ENTER TAIN MENT ) Ċĉ ĉ verify ( music Controller , Ġat Least Once ()). connect App Man ually ( arg That Ġ{ Ġthis . name Ġ== Ġ" Test 2 " Ġ} Ġ) Ċĉ ĉ mock Client . av _ request Player State ( 0 , ĠBM WR em oting . AV Connection Type . AV _ CONNECTION _ TYPE _ ENTER TAIN MENT , ĠBM WR em oting . AV Player State . AV _ PLAYER STATE _ PLAY ) Ċĉ ĉ verify ( music Controller , Ġat Least Once ()). play () ĊĊĉ ĉ // Ġclick Ġentry button Ġagain Ġafter Ġan Ġactive Ġapp Ġis Ġset Ċĉ ĉ wh enever ( music Controller . current App Info ). do Return ( Music App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class ")) Ċĉ ĉ wh enever ( music Controller . current App Controller ) Ġdo Return Ġmock < Music App Controller >() Ċĉ ĉ mock Client . rh mi _ on ActionEvent ( 1 , Ġ" unused ", ĠIDs . ENTRY BUTTON _ ACTION , Ġmap Of ( 0 Ġto Ġ 1 )) Ċĉ ĉ assertEquals ( IDs . PLAY BACK _ STATE , Ġmock Server . data [ IDs . ENTRY BUTTON _ DEST _ STATE ]) ĊĊĉ ĉ // Ġverify Ġthat Ġan Ġapp Ġlistener Ġis Ġconnecting , Ġto Ġredraw Ġon Ġchanges Ċĉ ĉ argument Captor < Runnable >(). apply Ġ{ Ċĉĉ ĉ verify ( music Controller ). listener Ġ= Ġcapture () Ċĉĉ ĉ last Value . run () Ċĉ ĉ } ĊĊĉ ĉ // Ġtest Ġthat Ġthe Ġplayback Ġview Ġredraw Ġdidn 't Ġhappen Ġsince Ġit 's Ġnot Ġfocused Ċĉ ĉ assertFalse ( app . playback View . visible ) Ċĉ ĉ assertEquals ( null , Ġmock Server . data [ IDs . AR TI ST _ LARGE _ MODEL ]) ĊĊĉ ĉ // Ġnow Ġredraw Ġwith Ġthe Ġplayback Ġview Ġselected Ċĉ ĉ mock Client . rh mi _ on H mi Event ( 1 , Ġ" unused ", ĠIDs . PLAY BACK _ STATE , Ġ 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ assertTrue ( app . playback View . visible ) Ċĉ ĉ verify ( music Controller , Ġat Least Once ()). getMetadata () ĊĊĉ ĉ // Ġverify Ġthings Ġhappened Ċĉ ĉ assertEquals (" Artist ", Ġmock Server . data [ IDs . AR TI ST _ LARGE _ MODEL ]) Ċĉ ĉ assertEquals (" Artist ", Ġmock Server . data [ IDs . AR TI ST _ SMALL _ MODEL ]) Ċĉ ĉ assertEquals (" Album ", Ġmock Server . data [ IDs . AL BU M _ LARGE _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . TRACK _ LARGE _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . TRACK _ SMALL _ MODEL ]) ĊĊĉ ĉ // Ġverify Ġglobal Ġmetadata Ġhappened Ċĉ ĉ assertEquals (" Artist ", Ġmock Server . data [ IDs . GLOBAL _ AR TI ST _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . GLOBAL _ TRACK _ MODEL ]) Ċĉ ĉ assertEquals (" Test 2 ", Ġmock Server . data [ IDs . GLOBAL _ APP _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . IC _ TRACK _ MODEL ]) Ċĉ ĉ assertTrue ( mock Server . triggered Events . containsKey ( IDs . MUL TIME DI A _ EVENT )) Ċĉ ĉ assertTrue ( mock Server . triggered Events . containsKey ( IDs . STATUS BAR _ EVENT )) ĊĊĉ ĉ // Ġshow Ġthe Ġapp Ġwindow Ġagain , Ġwith Ġan Ġapp Ġselected Ċĉ ĉ mock Client . rh mi _ on H mi Event ( 1 , Ġ" unused ", ĠIDs . APP LIST _ STATE , Ġ 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ assertEquals ( map Of ( 0 . to Byte () Ġto ĠIDs . APP LIST _ COMPONENT , Ġ 4 1 . to Byte () Ġto Ġ 1 ), Ġmock Server . triggered Events [ IDs . FOCUS _ EVENT ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Global Red raw () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) ĊĊĉ ĉ // Ġset Ġthe Ġcurrent Ġapp Ġand Ġsong Ċĉ ĉ wh enever ( music Controller . current App Info ). do Return ( Music App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class ")) Ċĉ ĉ wh enever ( music Controller . isConnected ()) Ġdo Return Ġtrue Ċĉ ĉ wh enever ( music Controller . getMetadata ()) Ġdo Return ĠMusic Metadata (" test Id ", Ġqueue Id = 1 0 , Ċĉĉĉ ĉ duration = 1 8 0 0 0 0 L , Ċĉĉĉ ĉ icon = mock (), Ġcover Art = mock (), Ċĉĉĉ ĉ artist =" Artist ", Ġalbum =" Album ", Ġtitle =" Title ") Ċĉ ĉ val Ġglobal State Ġ= ĠGlobal Metadata ( app , Ġmusic Controller ) Ċĉ ĉ global State . redraw () ĊĊĉ ĉ // Ġverify Ġglobal Ġmetadata Ġhappened Ċĉ ĉ assertEquals (" Artist ", Ġmock Server . data [ IDs . GLOBAL _ AR TI ST _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . GLOBAL _ TRACK _ MODEL ]) Ċĉ ĉ assertEquals (" Test 2 ", Ġmock Server . data [ IDs . GLOBAL _ APP _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . IC _ TRACK _ MODEL ]) Ċĉ ĉ assertEquals (" Ent IC Playlist ", Ġmock Server . data [ IDs . IC _ USE CASE _ MODEL ]) Ċĉ ĉ assertTrue ( mock Server . triggered Events . containsKey ( IDs . MUL TIME DI A _ EVENT )) Ċĉ ĉ assertTrue ( mock Server . triggered Events . containsKey ( IDs . STATUS BAR _ EVENT )) ĊĊĉ ĉ // Ġadd Ġa Ġqueue Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( null , Ġnull , ĠlistOf ( Ċĉĉĉ ĉ Music Metadata ( queue Id = 1 0 , Ġtitle =" Song Ġ 1 "), Ċĉĉĉ ĉ Music Metadata ( queue Id = 1 5 , Ġtitle =" Song Ġ 3 "), Ċĉĉĉ ĉ Music Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 6 "))) Ċĉ ĉ } Ċĉ ĉ global State . redraw () Ċĉ ĉ assertEquals (" Ent IC Playlist ", Ġmock Server . data [ IDs . IC _ USE CASE _ MODEL ]) Ċĉ ĉ val Ġdisplayed Titles Ġ= Ġ( mock Server . data [ IDs . IC _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ it [ 1 ] }. to Typed Array () Ċĉ ĉ val Ġdisplayed Checks Ġ= Ġ( mock Server . data [ IDs . IC _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ it [ 5 ] }. to Typed Array () Ċĉ ĉ assertArrayEquals ( array Of ("< ĠBack ", Ġ" Title ", Ġ" Next Ġ> ", Ġ" Song Ġ 3 ", Ġ" Song Ġ 6 "), Ġdisplayed Titles ) Ċĉ ĉ assertArrayEquals ( array Of ( 0 , Ġ 1 , Ġ 0 , Ġ 0 , Ġ 0 ), Ġdisplayed Checks ) ĊĊĉ ĉ // Ġchange Ġsong , Ġthe Ġcheckbox Ġshould Ġmove Ċĉ ĉ wh enever ( music Controller . getMetadata ()) Ġdo Return ĠMusic Metadata (" test Id ", Ġqueue Id = 2 0 , Ċĉĉĉ ĉ duration = 1 8 0 0 0 0 L , Ċĉĉĉ ĉ icon = mock (), Ġcover Art = mock (), Ċĉĉĉ ĉ artist =" Artist ", Ġalbum =" Album ", Ġtitle =" Song Ġ 6 ") Ċĉ ĉ global State . redraw () Ċĉ ĉ val Ġdisplayed Titles 2 Ġ= Ġ( mock Server . data [ IDs . IC _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ it [ 1 ] }. to Typed Array () Ċĉ ĉ val Ġdisplayed Checks 2 Ġ= Ġ( mock Server . data [ IDs . IC _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ it [ 5 ] }. to Typed Array () Ċĉ ĉ assertArrayEquals ( array Of (" Song Ġ 1 ", Ġ" Song Ġ 3 ", Ġ"< ĠBack ", Ġ" Song Ġ 6 ", Ġ" Next Ġ> "), Ġdisplayed Titles 2 ) Ċĉ ĉ assertArrayEquals ( array Of ( 0 , Ġ 0 , Ġ 0 , Ġ 1 , Ġ 0 ), Ġdisplayed Checks 2 ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Playback Red raw () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . PLAY BACK _ STATE ] Ġas ĠR H MI State . Toolbar State Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( state , Ġmusic Controller , Ġmap Of (" 1 4 7 . png " Ġto Ġ" Placeholder ". toByteArray ()), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) ĊĊĉ ĉ wh enever ( music Controller . get Queue ()). do Answer Ġ{ null } Ċĉ ĉ wh enever ( music Controller . current App Info ). do Return ( Music App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class ")) ĊĊĉ ĉ playback View . redraw () ĊĊĉ ĉ // Ġverify Ġthings Ġhappened Ċĉ ĉ verify ( music Controller , Ġat Least Once ()). getMetadata () Ċĉ ĉ assertNotNull ( mock Server . data [ IDs . APP ICON _ MODEL ]) Ċĉ ĉ assertEquals (" Bitmap { 3 2 0 x 3 2 0 }", Ġ(( mock Server . data [ IDs . COVER ART _ LARGE _ MODEL ] Ġas ĠBM WR em oting . RH MI Resource Data ). data Ġas ĠByteArray ). toString ( Charset . default Charset ())) Ċĉ ĉ assertEquals (" Bitmap { 2 0 0 x 2 0 0 }", Ġ(( mock Server . data [ IDs . COVER ART _ SMALL _ MODEL ] Ġas ĠBM WR em oting . RH MI Resource Data ). data Ġas ĠByteArray ). toString ( Charset . default Charset ())) Ċĉ ĉ assertEquals (" Artist ", Ġmock Server . data [ IDs . AR TI ST _ LARGE _ MODEL ]) Ċĉ ĉ assertEquals (" Artist ", Ġmock Server . data [ IDs . AR TI ST _ SMALL _ MODEL ]) Ċĉ ĉ assertEquals (" Album ", Ġmock Server . data [ IDs . AL BU M _ LARGE _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . TRACK _ LARGE _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . TRACK _ SMALL _ MODEL ]) Ċĉ ĉ assertEquals ( 2 , Ġmock Server . data [ IDs . TIME _ G AU GE _ MODEL ]) Ċĉ ĉ assertEquals (" ĠĠ 0 : 0 5 ", Ġmock Server . data [ IDs . TIME _ NUMBER _ SMALL _ MODEL ]) Ċĉ ĉ assertEquals (" ĠĠ 0 : 0 5 ", Ġmock Server . data [ IDs . TIME _ NUMBER _ LARGE _ MODEL ]) Ċĉ ĉ assertEquals (" ĠĠ 3 : 0 0 ", Ġmock Server . data [ IDs . MAX TIME _ NUMBER _ SMALL _ MODEL ]) Ċĉ ĉ assertEquals (" ĠĠ 3 : 0 0 ", Ġmock Server . data [ IDs . MAX TIME _ NUMBER _ LARGE _ MODEL ]) ĊĊĉ ĉ // Ġdon 't Ġenable Ġthe Ġqueue Ġbutton Ġfor Ġan Ġempty Ġqueue Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . TOOL BAR _ QUEUE _ BUTTON ] ! ![ RH MI Property . Property Id . ENABLED . id ]) ĊĊĉ ĉ // Ġnow Ġwe Ġhave Ġa Ġqueue ! Ċĉ ĉ wh enever ( music Controller . get Queue ()). do Answer Ġ{ ĠQueue Metadata ( null , Ġnull , ĠlistOf ( Music Metadata ())) Ġ} Ċĉ ĉ // Ġwe Ġshould Ġredraw Ġeven Ġif Ġthe Ġsong Ġhasn 't Ġchanged , Ġand Ġthe Ġbutton Ġshould Ġbe Ġenabled Ċĉ ĉ playback View . redraw () Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . TOOL BAR _ QUEUE _ BUTTON ] ! ![ RH MI Property . Property Id . ENABLED . id ]) ĊĊĉ ĉ // Ġdon 't Ġenable Ġthe ĠCustom ĠActions Ġbutton Ġfor Ġempty Ġcustom Ġactions Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . TOOL BAR _ ACTION _ BUTTON ] ! ![ RH MI Property . Property Id . ENABLED . id ]) Ċĉ ĉ // Ġadd Ġan Ġaction Ċĉ ĉ wh enever ( music Controller . get Custom Actions ()). do Answer Ġ{ ĠlistOf ( Custom Action (" test ", Ġ" test ", Ġ" Name ", Ġnull , Ġnull )) Ġ} Ċĉ ĉ // Ġwe Ġshould Ġredraw Ġeven Ġif Ġthe Ġsong Ġhasn 't Ġchanged , Ġand Ġthe Ġbutton Ġshould Ġbe Ġenabled Ċĉ ĉ playback View . redraw () Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . TOOL BAR _ ACTION _ BUTTON ] ! ![ RH MI Property . Property Id . ENABLED . id ]) ĊĊĉ ĉ // Ġnow Ġtest Ġa Ġdifferent Ġsong Ġwith Ġmissing Ġcover Ġart Ċĉ ĉ wh enever ( music Controller . getMetadata ()). do Answer Ġ{ Ċĉĉ ĉ Music Metadata (" test Id ", Ġduration Ġ= Ġ 1 8 0 0 0 0 L , Ċĉĉĉĉ ĉ icon Ġ= Ġmock (), Ġcover Art Ġ= Ġnull , Ċĉĉĉĉ ĉ artist Ġ= Ġ" Artist ", Ġalbum Ġ= Ġ" Album ", Ġtitle Ġ= Ġ" Title 2 ") Ċĉ ĉ } Ċĉ ĉ playback View . redraw () Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . COVER ART _ LARGE _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . COVER ART _ SMALL _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ]) ĊĊĉ ĉ // Ġdisconnect Ġthe Ġapp Ċĉ ĉ wh enever ( music Controller . isConnected ()) Ġdo Return Ġfalse Ċĉ ĉ wh enever ( music Controller . getMetadata ()) Ġdo Return Ġnull Ġas ĠMusic Metadata ? Ċĉ ĉ playback View . redraw () Ċĉ ĉ // Ġthe ĠArtist Ġfield Ġshould Ġsay ĠNot ĠConnected Ċĉ ĉ assertEquals ("< Not ĠConnected >", Ġmock Server . data [ IDs . AR TI ST _ LARGE _ MODEL ]) Ċĉ ĉ assertEquals ("< Not ĠConnected >", Ġmock Server . data [ IDs . AR TI ST _ SMALL _ MODEL ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Shuffle Button Red raw () Ġ{ Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Concrete () Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . PLAY BACK _ STATE ] Ġas ĠR H MI State . Toolbar State Ċĉ ĉ val Ġapp Switch er View Ġ= ĠApp Switch er View ( app . states [ IDs . APP LIST _ STATE ] !! , Ġmusic App Discovery , Ġmock (), Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( state , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġen queued View Ġ= ĠEn queued View ( app . states [ IDs . QUEUE _ STATE ] !! , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġaction View Ġ= ĠCustom Actions View ( app . states [ IDs . ACTION _ STATE ] !! , Ġgraphics Helpers , Ġmusic Controller ) ĊĊĉ ĉ playback View . init Widgets ( app Switch er View , Ġen queued View , Ġmock (), Ġaction View ) ĊĊĉ ĉ // Ġredraw Ġwhen Ġthe Ġbutton Ġis Ġsupported Ġand Ġnot Ġcurrently Ġsh uff ling Ċĉ ĉ wh enever ( music Controller . is Supported Action ( Music Action . SET _ SH UFF LE _ MODE )) Ġdo Answer Ġ{ Ġtrue Ġ} Ċĉ ĉ wh enever ( music Controller . is Sh uff ling ()) Ġdo Answer Ġ{ Ġfalse Ġ} Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( L . M US IC _ T URN _ SH UFF LE _ ON , Ġplayback View . shuffle Button . get Tooltip Model ()?. as Ra DataModel ()?. value ) Ċĉ ĉ assertEquals ( IDs . IMAGE ID _ SH UFF LE _ OFF , Ġplayback View . shuffle Button . getImage Model ()?. as Image Id Model ()?. image Id ) ĊĊĉ ĉ // Ġredraw Ġwhen Ġthe Ġbutton Ġis Ġsupported Ġand Ġcurrently Ġsh uff ling Ċĉ ĉ playback View . shuffle Button . getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 Ġto Ġtrue )) Ċĉ ĉ verify ( music Controller ). toggle Shuffle () ĊĊĉ ĉ wh enever ( music Controller . is Sh uff ling ()) Ġdo Answer Ġ{ Ġtrue Ġ} Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( L . M US IC _ T URN _ SH UFF LE _ OFF , Ġplayback View . shuffle Button . get Tooltip Model ()?. as Ra DataModel ()?. value ) Ċĉ ĉ assertEquals ( IDs . IMAGE ID _ SH UFF LE _ ON , Ġplayback View . shuffle Button . getImage Model ()?. as Image Id Model ()?. image Id ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Shuffle Button Red raw Unsupported () Ġ{ Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Concrete () Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . PLAY BACK _ STATE ] Ġas ĠR H MI State . Toolbar State Ċĉ ĉ val Ġapp Switch er View Ġ= ĠApp Switch er View ( app . states [ IDs . APP LIST _ STATE ] !! , Ġmusic App Discovery , Ġmock (), Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( state , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġen queued View Ġ= ĠEn queued View ( app . states [ IDs . QUEUE _ STATE ] !! , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġaction View Ġ= ĠCustom Actions View ( app . states [ IDs . ACTION _ STATE ] !! , Ġgraphics Helpers , Ġmusic Controller ) ĊĊĉ ĉ playback View . init Widgets ( app Switch er View , Ġen queued View , Ġmock (), Ġaction View ) ĊĊĉ ĉ wh enever ( music Controller . is Supported Action ( Music Action . SET _ SH UFF LE _ MODE )) Ġdo Answer Ġ{ Ġfalse Ġ} ĊĊĉ ĉ // i Drive Ġ 4 Ġhiding Ġbutton Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( 0 , Ġplayback View . shuffle Button . getImage Model ()?. as Image Id Model ()?. image Id ) ĊĊĉ ĉ // i Drive Ġ 5 + Ġhiding Ġbutton Ċĉ ĉ // Ġexception Ġthrowing Ġlogic Ġis Ġnot Ġworking Ġfor Ġtests Ġso Ġassume Ġthe Ġis New er ID rive Ġflag Ġis Ġset Ġproperly Ċĉ ĉ playback View . isNew er ID rive Ġ= Ġtrue Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( false , Ġplayback View . shuffle Button . properties [ RH MI Property . Property Id . VISIBLE . id ]?. value ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Repeat Button Red raw () Ġ{ Ċĉ ĉ // Ġrepeat Ġbutton Ġonly Ġavailable Ġin Ġi Drive Ġ 5 + Ġaudio H mi State Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Concrete () Ċĉ ĉ app . load From XML ( this . java Class . class Loader !!. getResource AsStream (" ui _ description _ mult imedia _ v 3 . xml ") ?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . AUDIO _ STATE ] Ġas ĠR H MI State . Audio H mi State Ċĉ ĉ val Ġapp Switch er View Ġ= ĠApp Switch er View ( app . states [ IDs . APP LIST _ ID 5 _ STATE ] !! , Ġmusic App Discovery , Ġmock (), Ġgraphics Helpers , ĠMusic Image IDs Spot ify ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( state , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Spot ify ) Ċĉ ĉ val Ġen queued View Ġ= ĠEn queued View ( app . states [ IDs . QUEUE _ ID 5 _ STATE ] !! , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Spot ify ) Ċĉ ĉ val Ġaction View Ġ= ĠCustom Actions View ( app . states [ IDs . ACTION _ ID 5 _ STATE ] !! , Ġgraphics Helpers , Ġmusic Controller ) ĊĊĉ ĉ playback View . init Widgets ( app Switch er View , Ġen queued View , Ġmock (), Ġaction View ) ĊĊĉ ĉ // Ġredraw Ġwhen Ġnot Ġrepe ating Ġand Ġsupported Ċĉ ĉ wh enever ( music Controller . is Supported Action ( Music Action . SET _ REPEAT _ MODE )) Ġdo Answer Ġ{ Ġtrue Ġ} Ċĉ ĉ wh enever ( music Controller . get Repeat Mode ()) Ġdo Return ĠRepeat Mode . OFF Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( L . M US IC _ T URN _ REPEAT _ ALL _ ON , Ġplayback View . repeat Button !!. get Tooltip Model ()?. as Ra DataModel ()?. value ) Ċĉ ĉ assertEquals ( Music Image IDs Spot ify . REPEAT _ OFF , Ġplayback View . repeat Button !!. getImage Model ()?. as Image Id Model ()?. image Id ) ĊĊĉ ĉ // Ġredraw Ġwhen Ġrepe ating Ġall Ġand Ġsupported Ċĉ ĉ playback View . repeat Button !!. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 Ġto Ġtrue )) Ċĉ ĉ verify ( music Controller , Ġtimes ( 1 )). toggle Repeat () ĊĊĉ ĉ wh enever ( music Controller . get Repeat Mode ()) Ġdo Return ĠRepeat Mode . ALL Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( L . M US IC _ T URN _ REPEAT _ ONE _ ON , Ġplayback View . repeat Button !!. get Tooltip Model ()?. as Ra DataModel ()?. value ) Ċĉ ĉ assertEquals ( Music Image IDs Spot ify . REPEAT _ ALL _ ON , Ġplayback View . repeat Button !!. getImage Model ()?. as Image Id Model ()?. image Id ) ĊĊĉ ĉ // Ġredraw Ġwhen Ġrepe ating Ġone Ġand Ġsupported Ċĉ ĉ playback View . repeat Button !!. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 Ġto Ġtrue )) Ċĉ ĉ verify ( music Controller , Ġtimes ( 2 )). toggle Repeat () ĊĊĉ ĉ wh enever ( music Controller . get Repeat Mode ()) Ġdo Return ĠRepeat Mode . ONE Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( L . M US IC _ T URN _ REPEAT _ OFF , Ġplayback View . repeat Button !!. get Tooltip Model ()?. as Ra DataModel ()?. value ) Ċĉ ĉ assertEquals ( Music Image IDs Spot ify . REPEAT _ ONE _ ON , Ġplayback View . repeat Button !!. getImage Model ()?. as Image Id Model ()?. image Id ) ĊĊĉ ĉ // Ġredraw Ġwhen Ġnot Ġrepe ating Ġand Ġsupported Ċĉ ĉ playback View . repeat Button !!. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 Ġto Ġtrue )) Ċĉ ĉ verify ( music Controller , Ġtimes ( 3 )). toggle Repeat () ĊĊĉ ĉ wh enever ( music Controller . get Repeat Mode ()) Ġdo Return ĠRepeat Mode . OFF Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( L . M US IC _ T URN _ REPEAT _ ALL _ ON , Ġplayback View . repeat Button !!. get Tooltip Model ()?. as Ra DataModel ()?. value ) Ċĉ ĉ assertEquals ( Music Image IDs Spot ify . REPEAT _ OFF , Ġplayback View . repeat Button !!. getImage Model ()?. as Image Id Model ()?. image Id ) ĊĊĉ ĉ // Ġredraw Ġwhen Ġnot Ġsupported Ċĉ ĉ wh enever ( music Controller . is Supported Action ( Music Action . SET _ REPEAT _ MODE )) Ġdo Answer Ġ{ Ġfalse Ġ} Ċĉ ĉ playback View . redraw () ĊĊĉ ĉ assertEquals ( false , Ġplayback View . repeat Button !!. properties [ RH MI Property . Property Id . ENABLED . id ]?. value ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Music Control () Ġ{ Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Concrete () Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . PLAY BACK _ STATE ] Ġas ĠR H MI State . Toolbar State Ċĉ ĉ val Ġapp Switch er View Ġ= ĠApp Switch er View ( app . states [ IDs . APP LIST _ STATE ] !! , Ġmusic App Discovery , Ġmock (), Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( state , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġen queued View Ġ= ĠEn queued View ( app . states [ IDs . QUEUE _ STATE ] !! , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġaction View Ġ= ĠCustom Actions View ( app . states [ IDs . ACTION _ STATE ] !! , Ġgraphics Helpers , Ġmusic Controller ) ĊĊĉ ĉ playback View . init Widgets ( app Switch er View , Ġen queued View , Ġmock (), Ġaction View ) ĊĊĉ ĉ state . toolbar Components List [ 7 ]. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 Ġto Ġtrue )) Ċĉ ĉ verify ( music Controller ). skip To Next () Ċĉ ĉ state . toolbar Components List [ 6 ]. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 Ġto Ġtrue )) Ċĉ ĉ verify ( music Controller ). skip To Previous () Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue View _ Null Queue () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġempty Queue Row Ġ= ĠarrayOf ("", Ġ"", Ġ"< Empty ĠQueue >") Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ Ġnull Ġ} Ċĉ ĉ queue View . show () ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 1 , Ġqueue List . total Rows ) Ċĉ ĉ assertArrayEquals ( empty Queue Row , Ġqueue List . data [ 0 ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . SELECT ABLE . id ]) ĊĊĉ ĉ assertEquals (" Now ĠPlay ing ", Ġmock Server . data [ IDs . QUEUE _ STATE _ TEXT _ MODEL ]) ĊĊĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ IMAGE _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue View _ Queue With Empty List _ With Cover Art Image _ With Title () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġempty Queue Row Ġ= ĠarrayOf ("", Ġ"", Ġ"< Empty ĠQueue >") Ċĉ ĉ val Ġqueue Title Ġ= Ġ" queue Ġtitle " Ċĉ ĉ val Ġqueue Cover Art : ĠBitmap Ġ= Ġmock () Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( queue Title , Ġnull , Ġempty List (), Ġqueue Cover Art ) Ġ} Ċĉ ĉ val Ġqueue Cover Art ByteArray Ġ= ĠByteArray ( 2 ) Ċĉ ĉ wh enever ( graphics Helpers . compress ( queue Cover Art , 1 8 0 , 1 8 0 , Ġquality Ġ= Ġ 6 0 )) Ġdo Answer Ġ{ Ġqueue Cover Art ByteArray Ġ} Ċĉ ĉ queue View . show () ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 1 , Ġqueue List . total Rows ) Ċĉ ĉ assertArrayEquals ( empty Queue Row , Ġqueue List . data [ 0 ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . SELECT ABLE . id ]) ĊĊĉ ĉ assertEquals ("$ queue Title Ġ- Ġ", Ġmock Server . data [ IDs . QUEUE _ STATE _ TEXT _ MODEL ]) ĊĊĉ ĉ val Ġqueue Cover Art Image Component Ġ= Ġmock Server . data [ IDs . QUEUE _ IMAGE _ MODEL ] Ġas ĠBM WR em oting . RH MI Resource Data Ċĉ ĉ assertEquals ( queue Cover Art ByteArray , Ġqueue Cover Art Image Component . getData ()) ĊĊĉ ĉ assertEquals ( queue Title , Ġmock Server . data [ IDs . QUEUE _ TITLE _ MODEL ]) Ċĉ ĉ assertEquals ("", Ġmock Server . data [ IDs . QUEUE _ SUB TITLE _ MODEL ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue View _ Queue Without Cover Art _ With Title () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġempty Queue Row Ġ= ĠarrayOf ("", Ġ"", Ġ"< Empty ĠQueue >") Ċĉ ĉ val Ġqueue Title Ġ= Ġ" queue Ġtitle " Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( queue Title , Ġnull , Ġempty List (), Ġnull ) Ġ} Ċĉ ĉ queue View . show () ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 1 , Ġqueue List . total Rows ) Ċĉ ĉ assertArrayEquals ( empty Queue Row , Ġqueue List . data [ 0 ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . SELECT ABLE . id ]) ĊĊĉ ĉ assertEquals ("$ queue Title Ġ- Ġ", Ġmock Server . data [ IDs . QUEUE _ STATE _ TEXT _ MODEL ]) ĊĊĉ ĉ assertEquals ("", Ġmock Server . data [ IDs . QUEUE _ TITLE _ MODEL ]) Ċĉ ĉ assertEquals ("", Ġmock Server . data [ IDs . QUEUE _ SUB TITLE _ MODEL ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue View _ Queue With Cover Art _ Without Title _ Without Subtitle () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġempty Queue Row Ġ= ĠarrayOf ("", Ġ"", Ġ"< Empty ĠQueue >") Ċĉ ĉ val Ġqueue Cover Art : ĠBitmap Ġ= Ġmock () Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( null , Ġnull , Ġempty List (), Ġqueue Cover Art ) Ġ} Ċĉ ĉ val Ġqueue Cover Art ByteArray Ġ= ĠByteArray ( 2 ) Ċĉ ĉ wh enever ( graphics Helpers . compress ( queue Cover Art , 1 8 0 , 1 8 0 , Ġquality Ġ= Ġ 6 0 )) Ġdo Answer Ġ{ Ġqueue Cover Art ByteArray Ġ} Ċĉ ĉ queue View . show () ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 1 , Ġqueue List . total Rows ) Ċĉ ĉ assertArrayEquals ( empty Queue Row , Ġqueue List . data [ 0 ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ]) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . SELECT ABLE . id ]) ĊĊĉ ĉ assertEquals (" Now ĠPlay ing ", Ġmock Server . data [ IDs . QUEUE _ STATE _ TEXT _ MODEL ]) ĊĊĉ ĉ val Ġqueue Cover Art Image Component Ġ= Ġmock Server . data [ IDs . QUEUE _ IMAGE _ MODEL ] Ġas ĠBM WR em oting . RH MI Resource Data Ċĉ ĉ assertEquals ( queue Cover Art ByteArray , Ġqueue Cover Art Image Component . getData ()) ĊĊĉ ĉ assertEquals ("", Ġmock Server . data [ IDs . QUEUE _ TITLE _ MODEL ]) Ċĉ ĉ assertEquals ("", Ġmock Server . data [ IDs . QUEUE _ SUB TITLE _ MODEL ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue View _ Queue Fully Pop ulated () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġqueue Title Ġ= Ġ" queue Ġtitle " Ċĉ ĉ val Ġqueue Subtitle Ġ= Ġ" queue Ġsubtitle " Ċĉ ĉ val Ġqueue Cover Art : ĠBitmap Ġ= Ġmock () Ċĉ ĉ val Ġmusic Metadata 1 Ġ= ĠMusic Metadata ( queue Id = 1 0 , Ġtitle =" Song Ġ 1 ", Ġartist =" Artist Ġ 1 ") Ċĉ ĉ val Ġmusic Metadata 2 Ġ= ĠMusic Metadata ( queue Id = 1 5 , Ġtitle =" Song Ġ 2 ", Ġartist =" Artist Ġ 2 ") Ċĉ ĉ val Ġmusic Metadata 3 Ġ= ĠMusic Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 3 ", Ġartist =" Artist Ġ 3 ") Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( queue Title , Ġqueue Subtitle , ĠlistOf ( Ċĉĉĉ ĉ music Metadata 1 , Ċĉĉĉ ĉ music Metadata 2 , Ċĉĉĉ ĉ music Metadata 3 Ċĉ ĉ ), Ġqueue Cover Art ) Ġ} Ċĉ ĉ val Ġqueue Cover Art ByteArray Ġ= ĠByteArray ( 2 ) Ċĉ ĉ wh enever ( graphics Helpers . compress ( queue Cover Art , 1 8 0 , 1 8 0 , Ġquality Ġ= Ġ 6 0 )) Ġdo Answer Ġ{ Ġqueue Cover Art ByteArray Ġ} Ċĉ ĉ queue View . show () ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 3 , Ġqueue List . total Rows ) ĊĊĉ ĉ val Ġcheck mark Resource Ġ= Ġqueue List . data [ 0 ][ 0 ] Ġas ĠBM WR em oting . RH MI Resource Identifier Ċĉ ĉ val Ġsong 1 Row Ġ= Ġqueue List . data [ 0 ] Ċĉ ĉ assertEquals ( 1 4 9 , Ġcheck mark Resource . id ) Ċĉ ĉ assertEquals ( BM WR em oting . RH MI ResourceType . IMAGE ID , Ġcheck mark Resource . type ) Ċĉ ĉ assertEquals ("", Ġsong 1 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġsong 1 Row [ 2 ]) Ċĉ ĉ assertEquals ( music Metadata 1 . title +"\ n "+ music Metadata 1 . artist , Ġsong 1 Row [ 3 ]) ĊĊĉ ĉ val Ġsong 2 Row Ġ= Ġqueue List . data [ 1 ] Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 0 ]) Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 2 ]) Ċĉ ĉ assertEquals ( music Metadata 2 . title +"\ n "+ music Metadata 2 . artist , Ġsong 2 Row [ 3 ]) ĊĊĉ ĉ val Ġsong 3 Row Ġ= Ġqueue List . data [ 2 ] Ċĉ ĉ assertEquals ("", Ġsong 3 Row [ 0 ]) Ċĉ ĉ assertEquals ("", Ġsong 3 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġsong 3 Row [ 2 ]) Ċĉ ĉ assertEquals ( music Metadata 3 . title +"\ n "+ music Metadata 3 . artist , Ġsong 3 Row [ 3 ]) ĊĊĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ]) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . QUEUE _ LIST _ COMPONENT ] ! ![ RH MI Property . Property Id . SELECT ABLE . id ]) ĊĊĉ ĉ assertEquals ("$ queue Title Ġ- Ġ$ queue Subtitle ", Ġmock Server . data [ IDs . QUEUE _ STATE _ TEXT _ MODEL ]) ĊĊĉ ĉ val Ġqueue Cover Art Image Component Ġ= Ġmock Server . data [ IDs . QUEUE _ IMAGE _ MODEL ] Ġas ĠBM WR em oting . RH MI Resource Data Ċĉ ĉ assertEquals ( queue Cover Art ByteArray , Ġqueue Cover Art Image Component . getData ()) ĊĊĉ ĉ assertEquals ( queue Title , Ġmock Server . data [ IDs . QUEUE _ TITLE _ MODEL ]) Ċĉ ĉ assertEquals ( queue Subtitle , Ġmock Server . data [ IDs . QUEUE _ SUB TITLE _ MODEL ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue Red raw _ Queue Different Than Current () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġqueue Title Ġ= Ġ" queue Ġtitle " Ċĉ ĉ val Ġqueue Subtitle Ġ= Ġ" queue Ġsubtitle " Ċĉ ĉ val Ġqueue Cover Art : ĠBitmap Ġ= Ġmock () Ċĉ ĉ val Ġmusic Metadata 1 Ġ= ĠMusic Metadata ( queue Id = 1 0 , Ġtitle =" Song Ġ 1 ", Ġartist =" Artist Ġ 1 ") Ċĉ ĉ val Ġmusic Metadata 2 Ġ= ĠMusic Metadata ( queue Id = 1 5 , Ġtitle =" Song Ġ 2 ", Ġartist =" Artist Ġ 2 ") Ċĉ ĉ val Ġmusic Metadata 3 Ġ= ĠMusic Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 3 ", Ġartist =" Artist Ġ 3 ") Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( queue Title , Ġqueue Subtitle , ĠlistOf ( Ċĉĉĉ ĉ music Metadata 1 , Ċĉĉĉ ĉ music Metadata 2 , Ċĉĉĉ ĉ music Metadata 3 Ċĉ ĉ ), Ġqueue Cover Art ) Ġ} ĊĊĉ ĉ queue View . show () ĊĊĉ ĉ val Ġnew Queue Title Ġ= Ġ" new Ġqueue Ġtitle " Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( new Queue Title , Ġnull , ĠlistOf ( Ċĉĉĉ ĉ music Metadata 1 , Ċĉĉĉ ĉ music Metadata 2 Ċĉ ĉ ), Ġnull ) Ġ} ĊĊĉ ĉ queue View . redraw () ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 2 , Ġqueue List . total Rows ) ĊĊĉ ĉ val Ġcheck mark Resource Ġ= Ġqueue List . data [ 0 ][ 0 ] Ġas ĠBM WR em oting . RH MI Resource Identifier Ċĉ ĉ val Ġsong 1 Row Ġ= Ġqueue List . data [ 0 ] Ċĉ ĉ assertEquals ( 1 4 9 , Ġcheck mark Resource . id ) Ċĉ ĉ assertEquals ( BM WR em oting . RH MI ResourceType . IMAGE ID , Ġcheck mark Resource . type ) Ċĉ ĉ assertEquals ("", Ġsong 1 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġsong 1 Row [ 2 ]) Ċĉ ĉ assertEquals ( music Metadata 1 . title +"\ n "+ music Metadata 1 . artist , Ġsong 1 Row [ 3 ]) ĊĊĉ ĉ val Ġsong 2 Row Ġ= Ġqueue List . data [ 1 ] Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 0 ]) Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 2 ]) Ċĉ ĉ assertEquals ( music Metadata 2 . title +"\ n "+ music Metadata 2 . artist , Ġsong 2 Row [ 3 ]) ĊĊĉ ĉ assertEquals ("$ new Queue Title Ġ- Ġ", Ġmock Server . data [ IDs . QUEUE _ STATE _ TEXT _ MODEL ]) ĊĊĉ ĉ assertEquals ("", Ġmock Server . data [ IDs . QUEUE _ TITLE _ MODEL ]) Ċĉ ĉ assertEquals ("", Ġmock Server . data [ IDs . QUEUE _ SUB TITLE _ MODEL ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue Red raw _ Different Song Playing Than Current () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġmusic Metadata 1 Ġ= ĠMusic Metadata ( queue Id = 1 0 , Ġtitle =" Song Ġ 1 ", Ġartist =" Artist Ġ 1 ", Ġmedia Id =" media Id 1 ") Ċĉ ĉ val Ġmusic Metadata 2 Ġ= ĠMusic Metadata ( queue Id = 1 5 , Ġtitle =" Song Ġ 2 ", Ġartist =" Artist Ġ 2 ", Ġmedia Id =" media Id 2 ") Ċĉ ĉ val Ġmusic Metadata 3 Ġ= ĠMusic Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 3 ", Ġartist =" Artist Ġ 3 ", Ġmedia Id =" media Id 3 ") Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( null , Ġnull , ĠlistOf ( Ċĉĉĉ ĉ music Metadata 1 , Ċĉĉĉ ĉ music Metadata 2 , Ċĉĉĉ ĉ music Metadata 3 Ċĉ ĉ ), Ġnull ) Ġ} ĊĊĉ ĉ queue View . show () ĊĊĉ ĉ wh enever ( music Controller . getMetadata ()) Ġdo Answer Ġ{ Ġmusic Metadata 3 Ġ} ĊĊĉ ĉ queue View . redraw () ĊĊĉ ĉ queue View . songs ListAdapter ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ĊĊĉ ĉ val Ġcheck mark Resource Ġ= Ġqueue List . data [ 0 ][ 0 ] Ġas ĠBM WR em oting . RH MI Resource Identifier Ċĉ ĉ assertEquals ( 1 4 9 , Ġcheck mark Resource . id ) Ċĉ ĉ assertEquals ( BM WR em oting . RH MI ResourceType . IMAGE ID , Ġcheck mark Resource . type ) Ċĉ ĉ val Ġsong 3 Row Ġ= Ġqueue List . data [ 0 ] Ċĉ ĉ assertEquals ("", Ġsong 3 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġsong 3 Row [ 2 ]) Ċĉ ĉ assertEquals ( music Metadata 3 . title +"\ n "+ music Metadata 3 . artist , Ġsong 3 Row [ 3 ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue Red raw _ Currently Visible Rows Changed () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġmock Music Metadata 2 : ĠMusic Metadata Ġ= Ġmock () Ċĉ ĉ val Ġmusic Metadata 1 Ġ= ĠMusic Metadata ( queue Id = 1 0 , Ġtitle =" Song Ġ 1 ", Ġartist =" Artist Ġ 1 ", Ġmedia Id Ġ= Ġ" media Id 1 ") Ċĉ ĉ val Ġmusic Metadata 3 Ġ= ĠMusic Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 3 ", Ġartist =" Artist Ġ 3 ", Ġmedia Id Ġ= Ġ" media Id 3 ") Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( null , Ġnull , ĠlistOf ( Ċĉĉĉ ĉ music Metadata 1 , Ċĉĉĉ ĉ mock Music Metadata 2 , Ċĉĉĉ ĉ music Metadata 3 Ċĉ ĉ ), Ġnull ) Ġ} Ċĉ ĉ val Ġsong 2 Title Ġ= Ġ" Song Ġ 2 " Ċĉ ĉ val Ġsong 2 Artist Ġ= Ġ" Artist Ġ 2 " Ċĉ ĉ wh enever ( mock Music Metadata 2 . queue Id ) Ġdo Answer Ġ{ Ġ 1 5 Ġ} Ċĉ ĉ wh enever ( mock Music Metadata 2 . title ) Ġdo Answer Ġ{ Ġsong 2 Title Ġ} Ċĉ ĉ wh enever ( mock Music Metadata 2 . artist ) Ġdo Answer Ġ{ Ġsong 2 Artist Ġ} Ċĉ ĉ wh enever ( mock Music Metadata 2 . media Id ) Ġdo Answer Ġ{ Ġ" media Id 2 " Ġ} ĊĊĉ ĉ queue View . show () Ċĉ ĉ // Ġtrigger Ġthe Ġrequest Ġdata Ġcallback Ċĉ ĉ app . components [ IDs . QUEUE _ LIST _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) ĊĊĉ ĉ val Ġcover Art : ĠBitmap Ġ= Ġmock () Ċĉ ĉ wh enever ( mock Music Metadata 2 . cover Art ) Ġdo Answer Ġ{ Ġcover Art Ġ} Ċĉ ĉ val Ġsong 2 Cover Art Image : ĠByteArray Ġ= Ġbyte ArrayOf ( 0 x 1 , Ġ 0 x 2 ) Ċĉ ĉ wh enever ( graphics Helpers . compress ( cover Art , Ġ 9 0 , Ġ 9 0 , Ġquality Ġ= Ġ 3 0 )) Ġdo Answer Ġ{ Ġsong 2 Cover Art Image Ġ} ĊĊĉ ĉ queue View . redraw () ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ val Ġsong 2 Row Ġ= Ġqueue List . data [ 1 ] Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 0 ]) Ċĉ ĉ assertEquals ( song 2 Cover Art Image , Ġsong 2 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 2 ]) Ċĉ ĉ assertEquals ( song 2 Title +"\ n "+ song 2 Artist , Ġsong 2 Row [ 3 ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue Red raw _ Currently Visible Rows Same () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġmock Music Metadata 2 : ĠMusic Metadata Ġ= Ġmock () Ċĉ ĉ val Ġmusic Metadata 1 Ġ= ĠMusic Metadata ( queue Id = 1 0 , Ġtitle =" Song Ġ 1 ", Ġartist =" Artist Ġ 1 ", Ġmedia Id Ġ= Ġ" media Id 1 ") Ċĉ ĉ val Ġmusic Metadata 3 Ġ= ĠMusic Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 3 ", Ġartist =" Artist Ġ 3 ", Ġmedia Id Ġ= Ġ" media Id 3 ") Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( null , Ġnull , ĠlistOf ( Ċĉĉĉ ĉ music Metadata 1 , Ċĉĉĉ ĉ mock Music Metadata 2 , Ċĉĉĉ ĉ music Metadata 3 Ċĉ ĉ ), Ġnull ) Ġ} Ċĉ ĉ val Ġsong 2 Title Ġ= Ġ" Song Ġ 2 " Ċĉ ĉ val Ġsong 2 Artist Ġ= Ġ" Artist Ġ 2 " Ċĉ ĉ wh enever ( mock Music Metadata 2 . queue Id ) Ġdo Answer Ġ{ Ġ 1 5 Ġ} Ċĉ ĉ wh enever ( mock Music Metadata 2 . title ) Ġdo Answer Ġ{ Ġsong 2 Title Ġ} Ċĉ ĉ wh enever ( mock Music Metadata 2 . artist ) Ġdo Answer Ġ{ Ġsong 2 Artist Ġ} Ċĉ ĉ wh enever ( mock Music Metadata 2 . media Id ) Ġdo Answer Ġ{ Ġ" media Id 2 " Ġ} ĊĊĉ ĉ queue View . show () Ċĉ ĉ // Ġtrigger Ġthe Ġrequest Ġdata Ġcallback Ċĉ ĉ app . components [ IDs . QUEUE _ LIST _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) ĊĊĉ ĉ queue View . redraw () ĊĊĉ ĉ val Ġqueue List Ġ= Ġmock Server . data [ IDs . QUEUE _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ val Ġsong 2 Row Ġ= Ġqueue List . data [ 1 ] Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 0 ]) Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġsong 2 Row [ 2 ]) Ċĉ ĉ assertEquals ( song 2 Title +"\ n "+ song 2 Artist , Ġsong 2 Row [ 3 ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue Input () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġen queued View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) ĊĊĉ ĉ val Ġsong 1 Title Ġ= Ġ" Song Ġ 1 " Ċĉ ĉ val Ġsong 1 Artist Ġ= Ġ" Artist Ġ 1 " Ċĉ ĉ val Ġsong 2 Title Ġ= Ġ" Song Ġ 2 " Ċĉ ĉ val Ġsong 2 Artist Ġ= Ġ" Artist Ġ 2 " Ċĉ ĉ val Ġsong 3 Title Ġ= Ġ" Song Ġ 3 " Ċĉ ĉ val Ġsong 3 Artist Ġ= Ġ" Artist Ġ 3 " Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( null , Ġnull , ĠlistOf ( Ċĉĉĉ ĉ Music Metadata ( queue Id = 1 0 , Ġtitle = song 1 Title , Ġartist = song 1 Artist ), Ċĉĉĉ ĉ Music Metadata ( queue Id = 1 5 , Ġtitle = song 2 Title , Ġartist = song 2 Artist ), Ċĉĉĉ ĉ Music Metadata ( queue Id = 2 0 , Ġtitle = song 3 Title , Ġartist = song 3 Artist ) Ċĉ ĉ )) Ġ} ĊĊĉ ĉ en queued View . init Widgets ( playback View ) Ċĉ ĉ en queued View . show () ĊĊĉ ĉ state . components [ IDs . QUEUE _ LIST _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 5 )) Ċĉ ĉ verify ( music Controller , Ġnever ()). play Queue ( any ()) Ċĉ ĉ state . components [ IDs . QUEUE _ LIST _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 1 )) Ċĉ ĉ verify ( music Controller ). play Queue ( Music Metadata ( queue Id = 1 5 , Ġtitle = song 2 Title , Ġartist Ġ= Ġsong 2 Artist )) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Queue View Queue Title And Subtitle () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġstate Ġ= Ġapp . states [ IDs . QUEUE _ STATE ] Ġas ĠR H MI State . Plain State Ċĉ ĉ val Ġqueue View Ġ= ĠEn queued View ( state , Ġmusic Controller , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ queue View . init Widgets ( playback View ) Ċĉ ĉ val Ġqueue Title Ġ= Ġ" queue Ġtitle " Ċĉ ĉ val Ġqueue Subtitle Ġ= Ġ" queue Ġsubtitle " Ċĉ ĉ val Ġqueue Cover Art : ĠBitmap Ġ= Ġmock () Ċĉ ĉ val Ġmusic Metadata 1 Ġ= ĠMusic Metadata ( queue Id = 1 0 , Ġtitle =" Song Ġ 1 ", Ġartist =" Artist Ġ 1 ", Ġmedia Id =" media Id 1 ") Ċĉ ĉ val Ġmusic Metadata 2 Ġ= ĠMusic Metadata ( queue Id = 1 5 , Ġtitle =" Song Ġ 2 ", Ġartist =" Artist Ġ 2 ", Ġmedia Id =" media Id 2 ") Ċĉ ĉ val Ġmusic Metadata 3 Ġ= ĠMusic Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 3 ", Ġartist =" Artist Ġ 3 ", Ġmedia Id =" media Id 3 ") Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( queue Title , Ġqueue Subtitle , ĠlistOf ( Ċĉĉĉ ĉ music Metadata 1 , Ċĉĉĉ ĉ music Metadata 2 , Ċĉĉĉ ĉ music Metadata 3 Ċĉ ĉ ), Ġqueue Cover Art ) Ġ} Ċĉ ĉ queue View . show () ĊĊĉ ĉ // Ġsong Ġ 1 Ġis Ġselected Ċĉ ĉ assertEquals ( 0 , Ġqueue View . selectedIndex ) Ċĉ ĉ assertEquals ( queue Title , Ġmock Server . data [ IDs . QUEUE _ TITLE _ MODEL ]) Ċĉ ĉ assertEquals ( queue Subtitle , Ġmock Server . data [ IDs . QUEUE _ SUB TITLE _ MODEL ]) ĊĊĉ ĉ // Ġsong Ġ 2 Ġis Ġselected Ċĉ ĉ app . components [ IDs . QUEUE _ LIST _ COMPONENT ]?. asList ()?. get Select Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 1 )) Ċĉ ĉ assertEquals ( 1 , Ġqueue View . selectedIndex ) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ TITLE _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ] Ġas ĠBoolean ?) Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . QUEUE _ SUB TITLE _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ] Ġas ĠBoolean ?) ĊĊĉ ĉ // Ġsong Ġ 1 Ġis Ġselected Ċĉ ĉ app . components [ IDs . QUEUE _ LIST _ COMPONENT ]?. asList ()?. get Select Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( 0 , Ġqueue View . selectedIndex ) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . QUEUE _ TITLE _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ] Ġas ĠBoolean ?) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . QUEUE _ SUB TITLE _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ] Ġas ĠBoolean ?) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Instrument Cluster () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġglobal State Ġ= ĠGlobal Metadata ( app , Ġmusic Controller ) Ċĉ ĉ global State . init Widgets () ĊĊĉ ĉ // Ġan Ġempty Ġqueue Ġwith Ġno Ġactions Ċĉ ĉ wh enever ( music Controller . is Supported Action ( any ())) Ġdo Return Ġfalse Ċĉ ĉ global State . redraw () Ċĉ ĉ assertEquals (" Ent IC Playlist ", Ġmock Server . data [ IDs . IC _ USE CASE _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . IC _ TRACK _ MODEL ]) Ċĉ ĉ val Ġempty list Ġ= Ġmock Server . data [ IDs . IC _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 1 , Ġempty list . total Rows ) Ċĉ ĉ assertArrayEquals ( array Of (" Title "), Ġempty list . data . map Ġ{ it [ 1 ] }. to Typed Array ()) ĊĊĉ ĉ // Ġan Ġempty Ġqueue ĠWITH Ġactions Ċĉ ĉ wh enever ( music Controller . is Supported Action ( any ())) Ġdo Return Ġtrue Ċĉ ĉ global State . display ed Song Ġ= Ġnull ĠĠĠ Ġ// Ġreset Ġfrom Ġthe Ġprevious Ġtest Ċĉ ĉ global State . redraw () Ċĉ ĉ assertEquals (" Ent IC Playlist ", Ġmock Server . data [ IDs . IC _ USE CASE _ MODEL ]) Ċĉ ĉ assertEquals (" Title ", Ġmock Server . data [ IDs . IC _ TRACK _ MODEL ]) Ċĉ ĉ val Ġsingle List Ġ= Ġmock Server . data [ IDs . IC _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 3 , Ġsingle List . total Rows ) Ċĉ ĉ assertArrayEquals ( array Of ("< ĠBack ", Ġ" Title ", Ġ" Next Ġ> "), Ġsingle List . data . map Ġ{ it [ 1 ] }. to Typed Array ()) ĊĊĉ ĉ app . actions [ IDs . IC _ TRACK _ ACTION ]?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ verify ( music Controller ). skip To Previous () Ċĉ ĉ app . actions [ IDs . IC _ TRACK _ ACTION ]?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 1 )) Ċĉ ĉ verify ( music Controller ). seek To ( 0 ) Ċĉ ĉ app . actions [ IDs . IC _ TRACK _ ACTION ]?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 2 )) Ċĉ ĉ verify ( music Controller ). skip To Next () ĊĊĉ ĉ // Ġa Ġqueue Ġthat Ġhas Ġthe Ġsong Ġin Ġplace Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( null , Ġnull , ĠlistOf ( Ċĉĉĉ ĉ Music Metadata ( queue Id = 1 0 , Ġtitle =" Song Ġ 1 ", Ġalbum =" Album ", Ġartist =" Artist "), Ċĉĉĉ ĉ Music Metadata ( queue Id = 1 5 , Ġtitle =" Song Ġ 3 "), Ċĉĉĉ ĉ Music Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 6 ") Ċĉ ĉ )) Ġ} Ċĉ ĉ global State . redraw () Ċĉ ĉ assertEquals (" Ent IC Playlist ", Ġmock Server . data [ IDs . IC _ USE CASE _ MODEL ]) Ċĉ ĉ val Ġlist Ġ= Ġmock Server . data [ IDs . IC _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertEquals ( 5 , Ġlist . total Rows ) Ċĉ ĉ assertEquals ("< ĠBack ", Ġlist . data [ 0 ][ 1 ]) Ċĉ ĉ assertEquals (" Title ", Ġlist . data [ 1 ][ 1 ]) Ċĉ ĉ assertEquals (" Artist ", Ġlist . data [ 1 ][ 2 ]) Ċĉ ĉ assertEquals (" Album ", Ġlist . data [ 1 ][ 3 ]) Ċĉ ĉ assertEquals ( 1 , Ġlist . data [ 1 ][ 5 ]) Ċĉ ĉ assertEquals (" Next Ġ> ", Ġlist . data [ 2 ][ 1 ]) Ċĉ ĉ assertEquals (" Song Ġ 3 ", Ġlist . data [ 3 ][ 1 ]) Ċĉ ĉ assertEquals ("", Ġlist . data [ 3 ][ 2 ]) Ċĉ ĉ assertEquals ("", Ġlist . data [ 3 ][ 3 ]) Ċĉ ĉ assertEquals ( 0 , Ġlist . data [ 3 ][ 5 ]) Ċĉ ĉ assertEquals (" Song Ġ 6 ", Ġlist . data [ 4 ][ 1 ]) ĊĊĉ ĉ app . actions [ IDs . IC _ TRACK _ ACTION ]?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ verify ( music Controller , Ġtimes ( 2 )). skip To Previous () Ċĉ ĉ app . actions [ IDs . IC _ TRACK _ ACTION ]?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 2 )) Ċĉ ĉ verify ( music Controller , Ġtimes ( 2 )). skip To Next () Ċĉ ĉ app . actions [ IDs . IC _ TRACK _ ACTION ]?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 4 )) Ċĉ ĉ verify ( music Controller ). play Queue ( Music Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 6 ")) ĊĊĉ ĉ // Ġa Ġqueue Ġwithout Ġthe Ġsong Ġin Ġplace Ċĉ ĉ wh enever ( music Controller . get Queue ()) Ġdo Answer Ġ{ ĠQueue Metadata ( null , Ġnull , ĠlistOf ( Ċĉĉĉ ĉ Music Metadata ( queue Id = 1 5 , Ġtitle =" Song Ġ 3 "), Ċĉĉĉ ĉ Music Metadata ( queue Id = 2 0 , Ġtitle =" Song Ġ 6 ") Ċĉ ĉ )) Ġ} Ċĉ ĉ global State . redraw () Ċĉ ĉ val Ġmissing List Ġ= Ġmock Server . data [ IDs . IC _ PLAY LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ assertArrayEquals ( array Of ("< ĠBack ", Ġ" Title ", Ġ" Next Ġ> "), Ġmissing List . data . map Ġ{ it [ 1 ] }. to Typed Array ()) Ċĉ ĉ assertArrayEquals ( array Of ( 0 , Ġ 1 , Ġ 0 ), Ġmissing List . data . map Ġ{ it [ 5 ] }. to Typed Array ()) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Browse _ Row Content () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġinput State ) ĊĊĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ċĉĉ ĉ browse Results Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . current App Info ) Ġdo Return ĠMusic App Info (" Test ", Ġmock (), Ġ" package ", Ġ" class ") ĊĊĉ ĉ val Ġpage Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page . show () ĊĊĉ ĉ val Ġfolder 1 Title Ġ= Ġ" Folder Ġ 1 " Ċĉ ĉ val Ġfolder 2 Title Ġ= Ġ" Folder Ġ 2 " Ċĉ ĉ val Ġfolder 2 Subtitle Ġ= Ġ" Subtitle " Ċĉ ĉ val Ġbrowse List Data Ġ= ĠlistOf ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder Ġ\ uD 8 3 D \ u DC 0 8 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" folder 1 ", Ġtitle Ġ= Ġfolder 1 Title , Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" folder 2 ", Ġtitle Ġ= Ġfolder 2 Title , Ġsubtitle Ġ= Ġfolder 2 Subtitle , Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ) Ċĉ ĉ ) Ċĉ ĉ browse Results . complete ( browse List Data ) Ċĉ ĉ await (). until Ġ{ Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 3 Ġ} Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) ĊĊĉ ĉ val Ġbrowse List Ġ= Ġmock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ val Ġfolder 1 Row Ġ= Ġbrowse List . data [ 1 ] Ċĉ ĉ assertEquals ("", Ġfolder 1 Row [ 0 ]) Ċĉ ĉ assertEquals ( BM WR em oting . RH MI ResourceType . IMAGE ID , Ġ( folder 1 Row [ 1 ] Ġas ĠBM WR em oting . RH MI Resource Identifier ). type ) Ċĉ ĉ assertEquals ( 1 5 5 , Ġ( folder 1 Row [ 1 ] Ġas ĠBM WR em oting . RH MI Resource Identifier ). id ) Ċĉ ĉ assertEquals ("", Ġfolder 1 Row [ 2 ]) Ċĉ ĉ assertEquals ( folder 1 Title Ġ+ Ġ"\ n ", Ġfolder 1 Row [ 3 ]) ĊĊĉ ĉ val Ġfolder 2 Row Ġ= Ġbrowse List . data [ 2 ] Ċĉ ĉ assertEquals ("", Ġfolder 2 Row [ 0 ]) Ċĉ ĉ assertEquals ( BM WR em oting . RH MI ResourceType . IMAGE ID , Ġ( folder 2 Row [ 1 ] Ġas ĠBM WR em oting . RH MI Resource Identifier ). type ) Ċĉ ĉ assertEquals ( 1 5 5 , Ġ( folder 2 Row [ 1 ] Ġas ĠBM WR em oting . RH MI Resource Identifier ). id ) Ċĉ ĉ assertEquals ("", Ġfolder 2 Row [ 2 ]) Ċĉ ĉ assertEquals ( folder 2 Title +"\ n "+ folder 2 Subtitle , Ġfolder 2 Row [ 3 ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Browse Red raw _ Currently Visible Rows Changed () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġinput State ) ĊĊĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ċĉĉ ĉ browse Results Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . current App Info ) Ġdo Return ĠMusic App Info (" Test ", Ġmock (), Ġ" package ", Ġ" class ") ĊĊĉ ĉ val Ġpage Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page . show () Ċĉ ĉ val Ġfolder 2 Title Ġ= Ġ" Folder Ġ 2 " Ċĉ ĉ val Ġmock Music Metadata : ĠMusic Metadata Ġ= Ġmock () Ċĉ ĉ wh enever ( mock Music Metadata . media Id ) Ġdo Answer Ġ{ Ġ" folder 2 " Ġ} Ċĉ ĉ wh enever ( mock Music Metadata . title ) Ġdo Answer Ġ{ Ġfolder 2 Title Ġ} Ċĉ ĉ wh enever ( mock Music Metadata . browse able ) Ġdo Answer Ġ{ Ġtrue Ġ} Ċĉ ĉ wh enever ( mock Music Metadata . play able ) Ġdo Answer Ġ{ Ġfalse Ġ} Ċĉ ĉ val Ġbrowse List Data Ġ= ĠlistOf ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder Ġ\ uD 8 3 D \ u DC 0 8 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" folder 1 ", Ġtitle Ġ= Ġ" Folder Ġ 1 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ mock Music Metadata , Ċĉĉĉ ĉ Music Metadata (" folder 3 ", Ġtitle Ġ= Ġ" Folder Ġ 3 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ) Ċĉ ĉ ) Ċĉ ĉ browse Results . complete ( browse List Data ) Ċĉ ĉ await (). until Ġ{ Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 4 Ġ} ĊĊĉ ĉ // Ġtrigger Ġthe Ġrequest Ġdata Ġcallback Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) ĊĊĉ ĉ val Ġcover Art : ĠBitmap Ġ= Ġmock () Ċĉ ĉ wh enever ( mock Music Metadata . cover Art ) Ġdo Answer Ġ{ Ġcover Art Ġ} Ċĉ ĉ val Ġfolder Cover Art Image : ĠByteArray Ġ= Ġbyte ArrayOf ( 0 x 1 , Ġ 0 x 2 ) Ċĉ ĉ wh enever ( graphics Helpers . compress ( cover Art , Ġ 9 0 , Ġ 9 0 , Ġquality Ġ= Ġ 3 0 )) Ġdo Answer Ġ{ Ġfolder Cover Art Image Ġ} ĊĊĉ ĉ page . redraw () ĊĊĉ ĉ val Ġbrowse List Ġ= Ġmock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ val Ġfolder 2 Row Ġ= Ġbrowse List . data [ 2 ] Ċĉ ĉ assertEquals ("", Ġfolder 2 Row [ 0 ]) Ċĉ ĉ assertEquals ( folder Cover Art Image , Ġfolder 2 Row [ 1 ]) Ċĉ ĉ assertEquals ("", Ġfolder 2 Row [ 2 ]) Ċĉ ĉ assertEquals ( folder 2 Title Ġ+ Ġ"\ n ", Ġfolder 2 Row [ 3 ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Browse Red raw _ Currently Visible Rows Same () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġinput State ) ĊĊĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ċĉĉ ĉ browse Results Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . current App Info ) Ġdo Return ĠMusic App Info (" Test ", Ġmock (), Ġ" package ", Ġ" class ") ĊĊĉ ĉ val Ġpage Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page . show () Ċĉ ĉ val Ġfolder 2 Title Ġ= Ġ" Folder Ġ 2 " Ċĉ ĉ val Ġmock Music Metadata : ĠMusic Metadata Ġ= Ġmock () Ċĉ ĉ wh enever ( mock Music Metadata . media Id ) Ġdo Answer Ġ{ Ġ" folder 2 " Ġ} Ċĉ ĉ wh enever ( mock Music Metadata . title ) Ġdo Answer Ġ{ Ġfolder 2 Title Ġ} Ċĉ ĉ wh enever ( mock Music Metadata . browse able ) Ġdo Answer Ġ{ Ġtrue Ġ} Ċĉ ĉ wh enever ( mock Music Metadata . play able ) Ġdo Answer Ġ{ Ġfalse Ġ} Ċĉ ĉ val Ġbrowse List Data Ġ= ĠlistOf ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder Ġ\ uD 8 3 D \ u DC 0 8 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" folder 1 ", Ġtitle Ġ= Ġ" Folder Ġ 1 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ mock Music Metadata , Ċĉĉĉ ĉ Music Metadata (" folder 3 ", Ġtitle Ġ= Ġ" Folder Ġ 3 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ) Ċĉ ĉ ) Ċĉ ĉ browse Results . complete ( browse List Data ) Ċĉ ĉ await (). until Ġ{ Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 4 Ġ} ĊĊĉ ĉ // Ġtrigger Ġthe Ġrequest Ġdata Ġcallback Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) ĊĊĉ ĉ page . redraw () ĊĊĉ ĉ val Ġbrowse List Ġ= Ġmock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable Ċĉ ĉ val Ġfolder 2 Row Ġ= Ġbrowse List . data [ 2 ] Ċĉ ĉ assertEquals ("", Ġfolder 2 Row [ 0 ]) Ċĉ ĉ assertEquals ( BM WR em oting . RH MI ResourceType . IMAGE ID , Ġ( folder 2 Row [ 1 ] Ġas ĠBM WR em oting . RH MI Resource Identifier ). type ) Ċĉ ĉ assertEquals ( 1 5 5 , Ġ( folder 2 Row [ 1 ] Ġas ĠBM WR em oting . RH MI Resource Identifier ). id ) Ċĉ ĉ assertEquals ("", Ġfolder 2 Row [ 2 ]) Ċĉ ĉ assertEquals ( folder 2 Title Ġ+ Ġ"\ n ", Ġfolder 2 Row [ 3 ]) Ċ ĉ } ĊĊ ĉ /** ĠSends Ġa Ġplaceholder Ġlist Ġif Ġtoo Ġbig Ġ*/ Ċ ĉ @ Test Ċ ĉ fun Ġtest Browse Red raw _ Deferred Loading () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġinput State ) ĊĊĉ ĉ val Ġbrowse Results 1 Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ċĉĉ ĉ browse Results 1 Ċĉ ĉ } ĊĊĉ ĉ val Ġpage Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page . show () Ċĉ ĉ assertEquals ("< Loading >", Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ][ 3 ]) Ċĉ ĉ browse Results 1 . complete ( listOf ( Ċĉĉĉ ĉ Music Metadata (" test Id ", Ġtitle Ġ= Ġ" Title ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ )) Ċĉ ĉ await (). until Ġ{ Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 1 Ġ} Ċĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. num Rows ) ĠĠĠĠĠ Ġ// Ġmake Ġsure Ġwe Ġactually Ġsend Ġthe Ġdata ĊĊĉ ĉ val Ġbrowse Results 5 Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ċĉĉ ĉ browse Results 5 Ċĉ ĉ } Ċĉ ĉ browse Results 5 . complete ( List ( 5 ) Ġ{ Ċĉĉ ĉ Music Metadata (" test Id $ it ", Ġtitle Ġ= Ġ" Title Ġ$ it ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ }) Ċĉ ĉ page . browse Page Model . contents Ġ= Ġbrowse Results 5 Ċĉ ĉ page . show () Ċĉ ĉ await (). until Ġ{ Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 5 Ġ} Ċĉ ĉ assertEquals ( 5 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. num Rows ) ĠĠĠĠĠ Ġ// Ġsend Ġthe Ġdata Ġfor Ġthis Ġshort Ġlist ĊĊĉ ĉ val Ġbrowse Results 1 1 Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ċĉĉ ĉ browse Results 1 1 Ċĉ ĉ } Ċĉ ĉ browse Results 1 1 . complete ( List ( 1 1 ) Ġ{ Ċĉĉ ĉ Music Metadata (" test Id $ it ", Ġtitle Ġ= Ġ" Title Ġ$ it ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ }) Ċĉ ĉ page . browse Page Model . contents Ġ= Ġbrowse Results 1 1 Ċĉ ĉ page . show () Ċĉ ĉ await (). until Ġ{ Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 1 1 Ġ} Ċĉ ĉ assertEquals ( 0 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. num Rows ) ĠĠĠĠĠ Ġ// Ġdo ĠNOT Ġsend Ġthe Ġdata Ġfor Ġthis Ġlong Ġlist Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertEquals ( 1 0 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. num Rows ) ĠĠĠĠĠ Ġ// Ġsend Ġthe Ġrequested Ġdata Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Browse Pages Indices () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġinput State ) ĊĊĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Return ĠComp letable Deferred ( emptyList ()) ĊĊĉ ĉ val Ġroot Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ assertEquals ( IDs . BROW SE 1 _ STATE , Ġroot . state . id ) ĊĊĉ ĉ val Ġsub dir 1 Ġ= Ġbrowse View . push Browse Page ( mock ()) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ STATE , Ġsub dir 1 . state . id ) Ċĉ ĉ val Ġsub dir 2 Ġ= Ġbrowse View . push Browse Page ( mock ()) Ċĉ ĉ assertEquals ( IDs . BROW SE 3 _ STATE , Ġsub dir 2 . state . id ) Ċĉ ĉ val Ġsub dir 3 Ġ= Ġbrowse View . push Browse Page ( mock ()) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ STATE , Ġsub dir 3 . state . id ) Ċĉ ĉ val Ġsub dir 4 Ġ= Ġbrowse View . push Browse Page ( mock ()) Ċĉ ĉ assertEquals ( IDs . BROW SE 3 _ STATE , Ġsub dir 4 . state . id ) Ċĉ ĉ val Ġsub dir 5 Ġ= Ġbrowse View . push Browse Page ( mock ()) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ STATE , Ġsub dir 5 . state . id ) Ċĉ ĉ val Ġsub dir 6 Ġ= Ġbrowse View . push Browse Page ( mock ()) Ċĉ ĉ assertEquals ( IDs . BROW SE 3 _ STATE , Ġsub dir 6 . state . id ) Ċ ĉ } ĊĊ ĉ @ Suppress (" Deferred Result Unused ") Ċ ĉ @ Test Ċ ĉ fun Ġtest Browse Pages () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġinput State ) ĊĊĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ċĉĉ ĉ browse Results Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . current App Info ) Ġdo Return ĠMusic App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class ") ĊĊĉ ĉ // Ġstart Ġb rowsing Ċĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ assertEquals ( listOf ( page 1 ), Ġbrowse View . page Stack ) Ċĉ ĉ assertEquals ( listOf ( null ), Ġbrowse View . location Stack ) Ċĉ ĉ assertEquals ( IDs . BROW SE 1 _ STATE , Ġpage 1 . state . id ) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . BROW SE 1 _ LABEL _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ] Ġas ĠBoolean ?) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . BROW SE 1 _ M US IC _ COMPONENT ] ! ![ RH MI Property . Property Id . VISIBLE . id ] Ġas ĠBoolean ?) Ċĉ ĉ page 1 . show () Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller , Ġtimes ( 1 )). browse Async ( any OrNull ()) Ġ} Ċĉ ĉ assertEquals ( listOf ( page 1 ), Ġbrowse View . page Stack ) Ċĉ ĉ assertEquals (" Browse ", Ġmock Server . data [ IDs . BROW SE 1 _ STATE _ MODEL ]) Ċĉ ĉ assertEquals (" Test 2 ", Ġmock Server . data [ IDs . BROW SE 1 _ LABEL _ MODEL ]) Ġ// Ġapp Ġname Ġat Ġthe Ġtop ĊĊĉ ĉ await (). until Ġ{ Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 1 Ġ} ĠĠĠ Ġ// Ġwait Ġfor Ġloader Ġto Ġshow ĊĊĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . BROW SE 1 _ M US IC _ COMPONENT ] ! ![ RH MI Property . Property Id . VALID . id ] Ġas ĠBoolean ?) Ġ Ġ// Ġrequest Ġdynamic Ġpaging Ċĉ ĉ assertEquals ( false , Ġmock Server . properties [ IDs . BROW SE 1 _ M US IC _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ] Ġas ĠBoolean ?) ĠĠ Ġ// Ġnot Ġclick able Ċĉ ĉ assertEquals ("< Loading >", Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ][ 3 ]) ĊĊĉ ĉ // Ġfinish Ġloading Ċĉ ĉ val Ġbrowse List Ġ= ĠlistOf ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder Ġ\ uD 8 3 D \ u DC 0 8 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 2 ", Ġtitle Ġ= Ġ" Bonus Folder 2 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 3 ", Ġtitle Ġ= Ġ" Bonus Folder 3 ", Ċĉĉĉĉ ĠĠĠĠĠĠĠ Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" File 1 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 2 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ ) Ċĉ ĉ browse Results . complete ( browse List ) Ċĉ ĉ await (). until Ġ{ Ċĉĉ ĉ ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 6 Ċĉ ĉ } Ċĉ ĉ assertArrayEquals ( array Of (" Folder Ġ: cat 2 :\ n ", Ġ" Bonus Folder 1 \ n ", Ġ" Bonus Folder 2 \ n ", Ġ" Bonus Folder 3 \ n ", Ġ" File 1 \ n ", Ġ" File 2 \ n "), Ċĉĉĉ ĉ ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉĉĉ ĉ it [ 3 ] Ċĉĉĉ ĉ }. to Typed Array () Ċĉ ĉ ) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . BROW SE 1 _ M US IC _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ] Ġas ĠBoolean ?) ĠĠĠ Ġ// Ġclick able + Ċĉ ĉ assertArrayEquals ( array Of (" Filter "), Ċĉĉĉ ĉ ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉĉĉ ĉ it [ 2 ] Ċĉĉĉ ĉ }. to Typed Array () Ċĉ ĉ ) ĊĊĉ ĉ // Ġgo Ġback Ġinto Ġthe Ġtop Ġlevel Ġbrowse , Ġit Ġshould Ġnot Ġhave ĠJump ĠBack Ċĉ ĉ val Ġbrowse Results Again Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ġ// Ġreset Ġthe ĠB rowse ĠDeferred Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ċĉĉ ĉ browse Results Again Ċĉ ĉ } Ċĉ ĉ page 1 . browse Page Model . contents Ġ= Ġbrowse Results Again Ċĉ ĉ page 1 . show () Ċĉ ĉ assertArrayEquals ( array Of (" Filter "), Ċĉĉĉ ĉ ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉĉĉ ĉ it [ 2 ] Ċĉĉĉ ĉ }. to Typed Array () Ċĉ ĉ ) Ċĉ ĉ // Ġverify Ġthat Ġit Ġdidn 't Ġshow Ġloading Ġscreen , Ġeven Ġif Ġthe Ġdeferred Ġis Ġstill Ġloading Ċĉ ĉ Thread . sleep ( 1 0 0 0 ) Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . BROW SE 1 _ M US IC _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ] Ġas ĠBoolean ?) ĠĠ Ġ// Ġstill Ġclick able Ċĉ ĉ assertEquals ( 6 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertArrayEquals ( array Of (" Folder Ġ: cat 2 :\ n ", Ġ" Bonus Folder 1 \ n ", Ġ" Bonus Folder 2 \ n ", Ġ" Bonus Folder 3 \ n ", Ġ" File 1 \ n ", Ġ" File 2 \ n "), Ċĉĉĉ ĉ ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉĉĉ ĉ it [ 3 ] Ċĉĉĉ ĉ }. to Typed Array () Ċĉ ĉ ) Ċĉ ĉ // Ġfinish Ġloading Ċĉ ĉ val Ġbrowse List Again Ġ= ĠlistOf ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 2 ", Ġtitle Ġ= Ġ" Bonus Folder 2 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 3 ", Ġtitle Ġ= Ġ" Bonus Folder 3 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" File 1 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 3 ", Ċĉĉĉĉĉ ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ ) Ċĉ ĉ browse Results Again . complete ( browse List Again ) Ċĉ ĉ await (). until Ġ{ Ċĉĉ ĉ ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 6 Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertArrayEquals ( array Of (" Folder \ n ", Ġ" Bonus Folder 1 \ n ", Ġ" Bonus Folder 2 \ n ", Ġ" Bonus Folder 3 \ n ", Ġ" File 1 \ n ", Ġ" File 3 \ n "), Ċĉĉĉ ĉ ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉĉĉ ĉ it [ 3 ] Ċĉĉĉ ĉ }. to Typed Array () Ċĉ ĉ ) ĊĊĉ ĉ // Ġclick Ġthe Ġfolder Ġ( test Id 1 : Folder , Ġto Ġshow Ġin ĠB ROW SE 2 ) Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback !!. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( 2 , Ġbrowse View . page Stack . size ) Ċĉ ĉ assertEquals ( 2 , Ġbrowse View . location Stack . size ) Ċĉ ĉ assertEquals (" test Id 1 ", Ġbrowse View . location Stack . last ()?. media Id ) Ċĉ ĉ val Ġstate 2 Ġ= Ġbrowse View . stack . last () Ċĉ ĉ val Ġpage 2 Ġ= Ġbrowse View . page Stack . last () Ċĉ ĉ assertEquals (" test Id 1 ", Ġstate 2 . location ?. media Id ) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ STATE , Ġpage 2 . state . id ) ĊĊĉ ĉ page 2 . show () Ċĉ ĉ assertEquals (" Folder ", Ġmock Server . data [ IDs . BROW SE 2 _ LABEL _ MODEL ]) Ġ// Ġfolder Ġname Ċĉ ĉ await (). until Ġ{ Ġ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows Ġ== Ġ 6 Ġ} Ċĉ ĉ app . components [ IDs . BROW SE 2 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ // Ġbrowse Ġresults Ġare Ġstill Ġresolved Ġfrom Ġlast Ġpage , Ġso Ġthey Ġshow Ġup Ġimmediately Ċĉ ĉ assertEquals ( true , Ġmock Server . properties [ IDs . BROW SE 2 _ M US IC _ COMPONENT ] ! ![ RH MI Property . Property Id . ENABLED . id ] Ġas ĠBoolean ?) Ċĉ ĉ assertArrayEquals ( array Of (" Folder \ n ", Ġ" Bonus Folder 1 \ n ", Ġ" Bonus Folder 2 \ n ", Ġ" Bonus Folder 3 \ n ", Ġ" File 1 \ n ", Ġ" File 3 \ n "), Ċĉĉĉ ĉ ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉĉĉ ĉ it [ 3 ] Ċĉĉĉ ĉ }. to Typed Array () Ċĉ ĉ ) ĊĊĉ ĉ // Ġselect Ġa Ġdeep Ġfolder Ġ( bonus Folder 1 : Bonus Folder 1 , Ġto Ġshow Ġin ĠB ROW SE 3 ) Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 1 _ M US IC _ MODEL ) Ċĉ ĉ app . components [ IDs . BROW SE 2 _ M US IC _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback !!. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 1 )) Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 3 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 6 , Ġ( mock Server . data [ IDs . BROW SE 3 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertEquals ( 3 , Ġbrowse View . page Stack . size ) Ċĉ ĉ assertEquals ( listOf ( null , Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder ", ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse )), Ċĉĉĉ ĉ browse View . location Stack ) Ċĉ ĉ assertEquals (" should Ġupdate Ġpreviously Selected ", Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ browse View . page Stack [ 1 ]. browse Page Model . previous ly Selected ) ĊĊĉ ĉ // Ġselect Ġa Ġdeeper Ġfolder Ġ( bonus Folder 2 : Bonus Folder 2 , Ġto Ġshow Ġin ĠB ROW SE 2 ) Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 2 _ M US IC _ MODEL ) Ċĉ ĉ app . components [ IDs . BROW SE 3 _ M US IC _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback !!. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 2 )) Ċĉ ĉ app . states [ IDs . BROW SE 3 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 6 , Ġ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 2 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertEquals ( 4 , Ġbrowse View . page Stack . size ) Ċĉ ĉ assertEquals ( listOf ( null , Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder ", ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), ĊĉĉĠĠĠĠĠĠĠ ĠMusic Metadata (" bonus Folder 2 ", Ġtitle Ġ= Ġ" Bonus Folder 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse )), Ċĉĉĉ ĉ browse View . location Stack ) Ċĉ ĉ assertEquals (" should Ġupdate Ġpreviously Selected ", Ċĉĉĉ ĉ Music Metadata (" bonus Folder 2 ", Ġtitle Ġ= Ġ" Bonus Folder 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ browse View . page Stack [ 2 ]. browse Page Model . previous ly Selected ) ĊĊĉ ĉ // Ġclick Ġthe Ġsong Ċĉ ĉ app . components [ IDs . BROW SE 3 _ M US IC _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback !!. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 4 )) Ċĉ ĉ assertEquals ( listOf ( null , Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder ", ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 2 ", Ġtitle Ġ= Ġ" Bonus Folder 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue )), Ċĉĉĉ ĉ browse View . location Stack ) Ċĉ ĉ verify ( music Controller ). play Song ( Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" File 1 ", Ċĉĉĉ ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue )) ĊĊĉ ĉ // Ġback Ġout Ġof Ġdeeper Ġfolder Ġ( now Ġshowing Ġbonus Folder 1 : Bonus Folder 1 ) Ċĉ ĉ mock Server . triggered Events . remove ( 6 ) Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 2 _ M US IC _ MODEL ) Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 3 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 6 , Ġ( mock Server . data [ IDs . BROW SE 3 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertEquals ( 3 , Ġbrowse View . page Stack . size ) Ċĉ ĉ assertEquals (" should Ġretain Ġlocation Stack Ġwhen Ġbacking Ġout ", ĠlistOf ( null , Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder ", ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 2 ", Ġtitle Ġ= Ġ" Bonus Folder 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue )), Ċĉĉĉ ĉ browse View . location Stack ) Ċĉ ĉ assertEquals ( Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ġbrowse View . page Stack . last (). browse Page Model . previous ly Selected ) Ċĉ ĉ assertEquals ( IDs . BROW SE 3 _ M US IC _ COMPONENT , Ġmock Server . triggered Events [ 6 ] ! ![ 0 . to Byte ()]) Ċĉ ĉ assertEquals (" Select s Ġpreviously Selected ", Ġ 4 , Ġmock Server . triggered Events [ 6 ] ! ![ 4 1 . to Byte ()]) ĊĊĉ ĉ // Ġback Ġout Ġof Ġdeep Ġfolder Ġ( now Ġshowing Ġtest Id 1 : Folder ) Ċĉ ĉ mock Server . triggered Events . remove ( 6 ) Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 2 _ M US IC _ MODEL ) Ċĉ ĉ app . states [ IDs . BROW SE 3 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 6 , Ġ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 2 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertEquals ( 2 , Ġbrowse View . page Stack . size ) Ċĉ ĉ assertEquals (" should Ġretain Ġlocation Stack Ġwhen Ġbacking Ġout ", ĠlistOf ( null , Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder ", ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 2 ", Ġtitle Ġ= Ġ" Bonus Folder 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue )), Ċĉĉĉ ĉ browse View . location Stack ) Ċĉ ĉ assertEquals ( Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ġbrowse View . page Stack . last (). browse Page Model . previous ly Selected ) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ M US IC _ COMPONENT , Ġmock Server . triggered Events [ 6 ] ! ![ 0 . to Byte ()]) Ċĉ ĉ assertEquals (" Select s Ġpreviously Selected ", Ġ 1 , Ġmock Server . triggered Events [ 6 ] ! ![ 4 1 . to Byte ()]) ĊĊĉ ĉ // Ġpress Ġback Ġagain Ġ( now Ġshowing Ġthe Ġnull Ġroot ) Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 1 _ M US IC _ MODEL ) Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 1 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 6 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertEquals ( 0 , Ġmock Server . triggered Events [ 6 ] ! ![ 4 1 . to Byte ()]) Ċĉ ĉ assertEquals ( listOf ( page 1 ), Ġbrowse View . page Stack ) Ċĉ ĉ assertEquals ( listOf ( null , Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Folder ", ĉ browse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 1 ", Ġtitle Ġ= Ġ" Bonus Folder 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" bonus Folder 2 ", Ġtitle Ġ= Ġ" Bonus Folder 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue )), Ċĉĉĉ ĉ browse View . location Stack ) ĊĊĉ ĉ // Ġselect Ġa Ġdifferent Ġfolder Ġ( bonus Folder 2 : Bonus Folder 2 ) Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 2 _ M US IC _ MODEL ) Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback !!. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 3 )) Ċĉ ĉ app . states [ IDs . BROW SE 1 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 6 , Ġ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 2 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertEquals ( 2 , Ġbrowse View . page Stack . size ) Ċĉ ĉ assertEquals ( listOf ( null , Ċĉĉĉ ĉ Music Metadata (" bonus Folder 3 ", Ġtitle Ġ= Ġ" Bonus Folder 3 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse )), Ċĉĉĉ ĉ browse View . location Stack ) ĠĠĠĠĠĠ Ġ// Ġdid Ġwe Ġtruncate Ġthe Ġlast Selected Ġstack Ġproperly ? Ċĉ ĉ assertEquals (" updates Ġpreviously Selected ", Ċĉĉĉ ĉ Music Metadata (" bonus Folder 3 ", Ġtitle Ġ= Ġ" Bonus Folder 3 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉ ĉ browse View . page Stack [ 0 ]. browse Page Model . previous ly Selected ) ĊĊĉ ĉ // Ġnow Ġif Ġwe Ġgo Ġback , Ġit Ġshould Ġupdate Ġthe Ġlast Selected Ġof Ġthe Ġmain Ġview Ġof Ġthe Ġfirst Ġpage Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 1 _ M US IC _ MODEL ) Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 1 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 6 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertEquals ( 3 , Ġmock Server . triggered Events [ 6 ] ! ![ 4 1 . to Byte ()]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Browse Shortcut () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġinput State ) ĊĊĉ ĉ wh enever ( music Controller . browse Async ( null )) Ġdo Answer Ġ{ Ċĉĉ ĉ Comp letable Deferred ( listOf Ġ( Ċĉĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉĉ ĉ Music Metadata (" folder 1 ", Ġtitle Ġ= Ġ" Folder ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ) Ċĉĉ ĉ )) Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . browse Async ( Music Metadata (" folder 1 ", Ġtitle Ġ= Ġ" Folder ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ))) Ġdo Answer Ġ{ Ċĉĉ ĉ Comp letable Deferred ( listOf Ġ( Ċĉĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉĉ ĉ )) Ċĉ ĉ } ĊĊĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 2 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } ĊĊĉ ĉ assertEquals (" Ġ/ ĠFolder ", Ġmock Server . data [ IDs . BROW SE 1 _ LABEL _ MODEL ]) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Browse Jump Back () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġinput State ) ĊĊĉ ĉ wh enever ( music Controller . browse Async ( null )) Ġdo Answer Ġ{ Ċĉĉ ĉ Comp letable Deferred ( listOf Ġ( Ċĉĉĉĉ ĉ Music Metadata (" special Id 1 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉĉ ĉ Music Metadata (" folder Deep 1 ", Ġtitle Ġ= Ġ" Folder Ġdeep 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉĉ ĉ )) Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . browse Async ( Music Metadata (" folder Deep 1 ", Ġtitle Ġ= Ġ" Folder Ġdeep 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ))) Ġdo Answer Ġ{ Ċĉĉ ĉ Comp letable Deferred ( listOf Ġ( Ċĉĉĉĉ ĉ Music Metadata (" folder Deep 2 ", Ġtitle Ġ= Ġ" Folder Ġdeep 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉĉ ĉ )) Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . browse Async ( Music Metadata (" folder Deep 2 ", Ġtitle Ġ= Ġ" Folder Ġdeep 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ))) Ġdo Answer Ġ{ Ċĉĉ ĉ Comp letable Deferred ( listOf Ġ( Ċĉĉĉĉ ĉ Music Metadata (" folder Deep 3 ", Ġtitle Ġ= Ġ" Folder Ġdeep 3 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ), Ċĉĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉĉ ĉ )) Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . browse Async ( Music Metadata (" folder Deep 3 ", Ġtitle Ġ= Ġ" Folder Ġdeep 3 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ))) Ġdo Answer Ġ{ Ċĉĉ ĉ Comp letable Deferred ( listOf Ġ( Ċĉĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉĉ ĉ )) Ċĉ ĉ } Ċĉ ĉ wh enever ( music Controller . browse Async ( Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ))) Ġdo Answer Ġ{ Ċĉĉ ĉ Comp letable Deferred ( listOf Ġ()) Ċĉ ĉ } ĊĊĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 3 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ // Ġmake Ġsure Ġthe ĠJump ĠBack Ġaction Ġisn 't Ġshowing Ċĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). total Rows ) Ċĉ ĉ assertArrayEquals ( array Of ("", Ġ"", Ġ" Filter "), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ]) Ċĉ ĉ assertEquals ("", Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ][ 0 ]) ĠĠĠ Ġ// Ġnot Ġchecked ĊĊĉ ĉ // Ġnow Ġshow Ġwith Ġa Ġprevious Ġlocation Ġstack Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 1 _ M US IC _ MODEL ) Ċĉ ĉ val Ġfolder Deep 1 Ġ= ĠMusic Metadata (" folder Deep 1 ", Ġtitle Ġ= Ġ" Folder Ġdeep 1 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ) Ċĉ ĉ val Ġfolder Deep 2 Ġ= ĠMusic Metadata (" folder Deep 2 ", Ġtitle Ġ= Ġ" Folder Ġdeep 2 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse ) Ċĉ ĉ browse View . stack . add ( Browse State ( folder Deep 1 , Ġmutable ListOf ( folder Deep 1 ))) Ċĉ ĉ browse View . stack . add ( Browse State ( folder Deep 2 , Ġmutable ListOf ( folder Deep 2 ))) Ċĉ ĉ page 1 . browse Page Model . show Jump back Action Ġ= Ġtrue Ċĉ ĉ page 1 . browse Page Model . previous ly Selected Ġ= Ġbrowse View . location Stack [ 1 ] Ċĉ ĉ page 1 . show () Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 3 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertArrayEquals ( array Of ("", Ġ"", Ġ" Jump ĠBack "), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ]) Ċĉ ĉ assertEquals (" Folder Ġdeep 1 \ n ", Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 1 ][ 3 ]) Ġ// Ġchecked Ċĉ ĉ assertNot Equals ("", Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 1 ][ 0 ]) Ġ// Ġchecked ĊĊĉ ĉ // Ġtry Ġclicking Ġthe Ġaction Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ assertEquals ( 2 , Ġbrowse View . page Stack . size ) Ċĉ ĉ val Ġpage 2 Ġ= Ġbrowse View . page Stack [ 1 ] Ċĉ ĉ page 2 . show () Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 3 , Ġ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 2 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) ĊĊĉ ĉ // Ġtest Ġwhat Ġhappens Ġwhen Ġa Ġdeeper Ġdirectory Ġis Ġclicked Ġinside ĠJump ĠBack Ċĉ ĉ browse View . push Browse Page ( Music Metadata (" folder Deep 3 ", Ġtitle Ġ= Ġ" Folder Ġdeep 3 ", Ġbrowse able Ġ= Ġtrue , Ġplay able Ġ= Ġfalse )) Ċĉ ĉ assertEquals ( 4 , Ġbrowse View . location Stack . size ) ĊĊĉ ĉ // Ġback Ġout Ġof Ġdeep Ġdir Ċĉ ĉ app . states [ IDs . BROW SE 1 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) ĊĊĉ ĉ // Ġback Ġout Ġof Ġjump Ġback Ċĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġfalse )) Ċĉ ĉ app . states [ IDs . BROW SE 1 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) ĊĊĉ ĉ // Ġensure Ġthat Ġthe Ġbrowse Ġstack Ġdidn 't Ġchange Ġafter Ġclicking ĠJump ĠBack Ċĉ ĉ assertEquals ( 4 , Ġbrowse View . location Stack . size ) Ċĉ ĉ assertEquals (" folder Deep 3 ", Ġbrowse View . location Stack . last ()?. media Id ) ĊĊĉ ĉ // Ġtest Ġwhat Ġhappens Ġwhen Ġa Ġsong Ġis Ġclicked Ġafter Ġjump ing Ġback Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget Model ()?. as Ra Int Model ()?. value Ġ= Ġ 0 Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 1 _ M US IC _ MODEL ) Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 2 _ M US IC _ MODEL ) Ċĉ ĉ val Ġtest Id 3 Ġ= ĠMusic Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ browse View . stack . add ( Browse State ( test Id 3 , Ġmutable ListOf ( test Id 3 ))) Ċĉ ĉ page 1 . show () Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 3 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ app . components [ IDs . BROW SE 1 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) Ċĉ ĉ assertArrayEquals ( array Of ("", Ġ"", Ġ" Jump ĠBack "), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ]) Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ assertEquals ( 2 , Ġbrowse View . page Stack . size ) Ċĉ ĉ assertEquals (" test Id 3 ", Ġbrowse View . stack . last (). location ?. media Id ) Ċĉ ĉ assertEquals ( listOf ( null , Ġ" folder Deep 1 ", Ġ" folder Deep 2 ", Ġ" folder Deep 3 ", Ġ" test Id 3 "), Ġbrowse View . stack . map Ġ{ it . location ?. media Id }) Ċĉ ĉ browse View . page Stack . last (). show () Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 2 , Ġ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } ĊĊĉ ĉ // Ġnow Ġtest Ġwhat Ġhappens Ġat Ġa Ġfresh Ġnew Ġbrowse , Ġeverything Ġshould Ġall Ġbe Ġin Ġplace Ċĉ ĉ browse View . clear Pages () Ċĉ ĉ val Ġfresh page Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ assertEquals ( listOf ( null , Ġ" folder Deep 1 ", Ġ" folder Deep 2 ", Ġ" folder Deep 3 ", Ġ" test Id 3 "), Ġbrowse View . stack . map Ġ{ it . location ?. media Id }) Ċĉ ĉ assertEquals (" folder Deep 1 ", Ġfresh page . browse Page Model . previous ly Selected ?. media Id ) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Browse Filter () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) ĊĊĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ġbrowse Results Ġ} ĊĊĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () ĊĊĉ ĉ // Ġwait Ġfor Ġthe Ġloading Ġscreen Ġto Ġshow Ġup Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). total Rows ) ĠĠĠ Ġ// Ġshows ĠFilter Ġwhile Ġloading ĊĊĉ ĉ // Ġthen Ġfinish Ġloading Ċĉ ĉ browse Results . complete ( listOf Ġ( Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 5 ", Ġtitle Ġ= Ġ" Best Ġs new Ġsong ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 4 ", Ġtitle Ġ= Ġ" New Ġsong Ġ\ uD 8 3 D \ u DC 0 8 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertArrayEquals ( array Of ("", Ġ"", Ġ" Filter "), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ]) ĊĊĉ ĉ // Ġtry Ġclicking Ġthe Ġaction Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . INPUT _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ // Ġthere Ġshould Ġbe Ġaction Ġhandlers Ġnow Ċĉ ĉ assertNotNull ( app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()) Ċĉ ĉ assertNotNull ( app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()) ĊĊĉ ĉ // Ġtry Ġentering Ġa Ġquery Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġ" n ")) ĊĊĉ ĉ assertEquals ( listOf (" New Ġsong Ġ: cat 2 :", Ġ" Best Ġs new Ġsong "), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ġit [ 0 ] Ġ}) Ċĉ ĉ // Ġselect Ġa Ġsuggestion Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 1 )) Ċĉ ĉ assertEquals ( IDs . PLAY BACK _ STATE , Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ verify ( music Controller ). play Song ( Music Metadata (" test Id 5 ", Ġtitle Ġ= Ġ" Best Ġs new Ġsong ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue )) ĊĊĉ ĉ // Ġtry Ġentering Ġan Ġemoji Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġ" del all ")) Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġ" cat ")) Ċĉ ĉ assertEquals ( listOf (" New Ġsong Ġ: cat 2 :" ), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ġit [ 0 ] Ġ}) ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Browse Filter Deferred () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) ĊĊĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ġbrowse Results Ġ} ĊĊĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () ĊĊĉ ĉ // Ġwait Ġfor Ġthe Ġloading Ġscreen Ġto Ġshow Ġup Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). total Rows ) ĠĠĠ Ġ// Ġshows ĠFilter Ġwhile Ġloading ĊĊĉ ĉ // Ġskip Ġright Ġto ĠFilter Ġbefore Ġit 's Ġfinished Ġloading Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . INPUT _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ val Ġinput Ġ= Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input () !! Ċĉ ĉ app . states [ IDs . INPUT _ STATE ]?. focus Callback ?. on Focus ( true ) ĊĊĉ ĉ // Ġthere Ġshould Ġbe Ġaction Ġhandlers Ġnow Ċĉ ĉ assertNotNull ( input . getAction ()) Ċĉ ĉ assertNotNull ( input . get Suggest Action ()) ĊĊĉ ĉ // Ġit Ġshould Ġshow Ġ" Loading " Ġin Ġthe Ġfilter Ġbox Ċĉ ĉ assertEquals ( L . M US IC _ BROW SE _ LOADING , Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ][ 0 ]) ĊĊĉ ĉ // Ġtry Ġentering Ġa Ġquery Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġ" n ")) ĊĊĉ ĉ // Ġit Ġshould Ġstill Ġshow Ġ" Loading " Ġin Ġthe Ġfilter Ġbox Ċĉ ĉ assertEquals ( L . M US IC _ BROW SE _ LOADING , Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 0 ][ 0 ]) ĊĊĉ ĉ // Ġthen Ġfinish Ġloading Ċĉ ĉ browse Results . complete ( listOf Ġ( Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 5 ", Ġtitle Ġ= Ġ" Best Ġs new Ġsong ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 4 ", Ġtitle Ġ= Ġ" New Ġsong Ġ\ uD 8 3 D \ u DC 0 8 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ )) ĊĊĉ ĉ // Ġit Ġshould Ġupdate Ġthe Ġresults Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( listOf (" New Ġsong Ġ: cat 2 :", Ġ" Best Ġs new Ġsong "), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ġit [ 0 ] Ġ}) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ @ Suppress (" Deferred Result Unused ") Ċ ĉ @ Test Ċ ĉ fun Ġtest Search () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) ĊĊĉ ĉ // Ġprepare Ġresults Ċĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ġbrowse Results Ġ} Ċĉ ĉ val Ġsearch Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . search Async ( any OrNull ())) Ġdo Answer Ġ{ Ġsearch Results Ġ} ĊĊĉ ĉ // Ġpret end Ġthat Ġthe Ġapp Ġisn 't Ġsearch able Ċĉ ĉ wh enever ( music Controller . current App Info ) Ġdo Return ĠMusic App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class ") Ċĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () ĊĊĉ ĉ // Ġwait Ġfor Ġthe Ġloading Ġscreen Ġto Ġshow Ġup Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). total Rows ) ĠĠĠ Ġ// Ġshould Ġnot Ġshow ĠSearch ĊĊĉ ĉ // Ġnow Ġpret end Ġthat Ġthe Ġapp ĠIS Ġsearch able Ċĉ ĉ wh enever ( music Controller . current App Info ). do Return ( Ċĉĉĉ ĉ Music App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class "). apply Ġ{ Ġsearch able Ġ= Ġtrue } Ċĉ ĉ ) Ċĉ ĉ page 1 . hide () Ċĉ ĉ mock Server . data . remove ( IDs . BROW SE 1 _ M US IC _ MODEL ) Ċĉ ĉ browse View . stack . clear () Ċĉ ĉ val Ġpage 1 Again Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 Again . show () Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertEquals ( listOf (" Search ", Ġ" Filter "), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ it [ 2 ]}) Ċĉ ĉ assertArrayEquals ( array Of ( array Of ("", Ġ"", Ġ" Search "), ĠarrayOf ("", Ġ"", Ġ" Filter ")), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data ) ĊĊĉ ĉ // Ġthen Ġfinish Ġloading Ġbrowse Ċĉ ĉ browse Results . complete ( listOf Ġ( Ċĉĉĉ ĉ Music Metadata (" test Id 2 ", Ġtitle Ġ= Ġ" Play ĠAll ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 3 ", Ġtitle Ġ= Ġ" File 1 ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 5 ", Ġtitle Ġ= Ġ" Best Ġs new Ġsong ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 4 ", Ġtitle Ġ= Ġ" New Ġsong ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 4 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertEquals ( listOf (" Search ", Ġ" Filter "), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ it [ 2 ]}) Ċĉ ĉ assertArrayEquals ( array Of ( array Of ("", Ġ"", Ġ" Search "), ĠarrayOf ("", Ġ"", Ġ" Filter ")), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data ) ĊĊĉ ĉ // Ġtry Ġclicking Ġthe Ġaction Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . INPUT _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ // Ġthere Ġshould Ġbe Ġaction Ġhandlers Ġnow Ċĉ ĉ assertNotNull ( app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()) Ċĉ ĉ assertNotNull ( app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()) ĊĊĉ ĉ // Ġtry Ġentering Ġa Ġtoo - short Ġquery Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġ" n ")) Ċĉ ĉ verify ( music Controller , Ġnever ()). search Async ( any ()) ĊĊĉ ĉ // Ġenter Ġa Ġlonger Ġquery Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġ" mar io ")) Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller , Ġtimes ( 1 )). search Async ( any ()) Ġ} ĊĊĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ("< Searching > ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } Ċĉ ĉ // Ġsearch Ġresults Ġfinished Ġloading Ċĉ ĉ search Results . complete ( listOf ( Music Metadata (" test Id 5 ", Ġtitle Ġ= Ġ" Best Ġs new Ġsong ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test Id 4 ", Ġtitle Ġ= Ġ" New Ġsong ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ))) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ( L . M US IC _ SEARCH _ RESULTS _ VIEW _ FULL _ RESULTS ), ĠarrayOf (" Best Ġs new Ġsong "), ĠarrayOf (" New Ġsong ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġselect Ġa Ġsuggestion Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 2 )) Ċĉ ĉ assertEquals ( IDs . PLAY BACK _ STATE , Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ verify ( music Controller ). play Song ( Music Metadata (" test Id 4 ", Ġtitle Ġ= Ġ" New Ġsong ", Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue )) Ċ ĉ } ĊĊ ĉ @ Suppress (" Deferred Result Unused ") Ċ ĉ @ Test Ċ ĉ fun Ġtest Search _ SearchResult Browse View () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) ĊĊĉ ĉ // Ġprepare Ġresults Ċĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ġbrowse Results Ġ} Ċĉ ĉ val Ġsearch Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . search Async ( any OrNull ())) Ġdo Answer Ġ{ Ġsearch Results Ġ} ĊĊĉ ĉ wh enever ( music Controller . current App Info ). do Return ( Ċĉĉĉ ĉ Music App Info (" Test ", Ġmock (), Ġ" package ", Ġ" class "). apply Ġ{ Ġsearch able Ġ= Ġtrue } Ċĉ ĉ ) ĊĊĉ ĉ // Ġdisplay Ġbrowse Ġpage Ġhome Ċĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () ĊĊĉ ĉ // Ġthen Ġfinish Ġloading Ġbrowse Ċĉ ĉ browse Results . complete ( listOf Ġ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Browse ĠItem ĠTitle ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉ ĉ )) ĊĊĉ ĉ // Ġclicking Ġthe Ġsearch Ġaction Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . INPUT _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) ĊĊĉ ĉ // Ġsearch Ġwith Ġa Ġquery Ċĉ ĉ val Ġquery Ġ= Ġ" valid Ġquery " Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġquery )) Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller , Ġtimes ( 1 )). search Async ( query ) Ġ} ĊĊĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ("< Searching > ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġsearch Ġresults Ġfinished Ġloading Ċĉ ĉ val Ġitem 1 Title Ġ= Ġ" Item Ġ 1 " Ċĉ ĉ val Ġitem 2 Title Ġ= Ġ" Item Ġ 2 " Ċĉ ĉ search Results . complete ( listOf ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġitem 1 Title , Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test id 2 ", Ġtitle Ġ= Ġitem 2 Title , Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ( L . M US IC _ SEARCH _ RESULTS _ VIEW _ FULL _ RESULTS ), ĠarrayOf ( item 1 Title ), ĠarrayOf ( item 2 Title )), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġuser Ġclicks ĠOK Ġbutton Ġon Ġinput Ġstate Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getResult Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ STATE , Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getResult Action ()?. as H MI Action ()?. getTarget State ()?. id ) ĊĊĉ ĉ app . states [ IDs . BROW SE 2 _ STATE ]?. on H mi Event ( 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ app . components [ IDs . BROW SE 2 _ M US IC _ COMPONENT ]?. request Data Callback ?. on Request Data ( 0 , Ġ 1 0 ) ĊĊĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 2 , Ġ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } ĊĊĉ ĉ // Ġensure Ġsearch Ġresults Ġpage Ġis Ġshown Ġwith Ġthe Ġcorrect Ġdata Ċĉ ĉ assertEquals ( L . M US IC _ SEARCH _ RESULTS _ LABEL , Ġmock Server . data [ IDs . BROW SE 2 _ LABEL _ MODEL ]) ĊĊĉ ĉ val Ġsongs Ġ= Ġ( mock Server . data [ IDs . BROW SE 2 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data Ċĉ ĉ assertEquals ( 2 , Ġsongs . size ) Ċĉ ĉ assertEquals ("${ item 1 Title }\ n ", Ġsongs [ 0 ][ 3 ]) Ċĉ ĉ assertEquals ("${ item 2 Title }\ n ", Ġsongs [ 1 ][ 3 ]) Ċ ĉ } ĊĊ ĉ @ Suppress (" Deferred Result Unused ") Ċ ĉ @ Test Ċ ĉ fun Ġtest Search _ View Full Results Clicked () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) ĊĊĉ ĉ // Ġprepare Ġresults Ċĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ġbrowse Results Ġ} Ċĉ ĉ val Ġsearch Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . search Async ( any OrNull ())) Ġdo Answer Ġ{ Ġsearch Results Ġ} ĊĊĉ ĉ wh enever ( music Controller . current App Info ). do Return ( Ċĉĉĉ ĉ Music App Info (" Test ", Ġmock (), Ġ" package ", Ġ" class "). apply Ġ{ Ġsearch able Ġ= Ġtrue } Ċĉ ĉ ) ĊĊĉ ĉ // Ġdisplay Ġbrowse Ġpage Ġhome Ċĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () ĊĊĉ ĉ // Ġthen Ġfinish Ġloading Ġbrowse Ċĉ ĉ browse Results . complete ( listOf Ġ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Browse ĠItem ĠTitle ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉ ĉ )) ĊĊĉ ĉ // Ġclicking Ġthe Ġsearch Ġaction Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . INPUT _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) ĊĊĉ ĉ // Ġsearch Ġwith Ġa Ġquery Ċĉ ĉ val Ġquery Ġ= Ġ" valid Ġquery " Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġquery )) Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller , Ġtimes ( 1 )). search Async ( query ) Ġ} ĊĊĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ("< Searching > ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġsearch Ġresults Ġfinished Ġloading Ċĉ ĉ val Ġitem 1 Title Ġ= Ġ" Item Ġ 1 " Ċĉ ĉ val Ġitem 2 Title Ġ= Ġ" Item Ġ 2 " Ċĉ ĉ search Results . complete ( listOf ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġitem 1 Title , Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉĉĉ ĉ Music Metadata (" test id 2 ", Ġtitle Ġ= Ġitem 2 Title , Ġbrowse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ) Ċĉ ĉ )) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ( L . M US IC _ SEARCH _ RESULTS _ VIEW _ FULL _ RESULTS ), ĠarrayOf ( item 1 Title ), ĠarrayOf ( item 2 Title )), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġuser Ġclicks Ġ" View ĠFull ĠResults " Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . BROW SE 2 _ STATE , Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as H MI Action ()?. getTarget State ()?. id ) Ċ ĉ } ĊĊ ĉ @ Suppress (" Deferred Result Unused ") Ċ ĉ @ Test Ċ ĉ fun Ġtest Search _ Ok Button Clicked _ Empty SearchResults _ Not Spot ify Music App () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) ĊĊĉ ĉ // Ġprepare Ġresults Ċĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ġbrowse Results Ġ} Ċĉ ĉ val Ġsearch Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . search Async ( any OrNull ())) Ġdo Answer Ġ{ Ġsearch Results Ġ} ĊĊĉ ĉ wh enever ( music Controller . current App Info ). do Return ( Ċĉĉĉ ĉ Music App Info (" Test ", Ġmock (), Ġ" package ", Ġ" class "). apply Ġ{ Ġsearch able Ġ= Ġtrue } Ċĉ ĉ ) ĊĊĉ ĉ // Ġdisplay Ġbrowse Ġpage Ġhome Ċĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () ĊĊĉ ĉ // Ġthen Ġfinish Ġloading Ġbrowse Ċĉ ĉ browse Results . complete ( listOf Ġ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Browse ĠItem ĠTitle ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉ ĉ )) ĊĊĉ ĉ // Ġclicking Ġthe Ġsearch Ġaction Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . INPUT _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) ĊĊĉ ĉ // Ġsearch Ġwith Ġa Ġquery Ċĉ ĉ val Ġquery Ġ= Ġ" query " Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġquery )) Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller , Ġtimes ( 1 )). search Async ( query ) Ġ} ĊĊĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ("< Searching > ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġsearch Ġresults Ġfinished Ġloading Ċĉ ĉ search Results . complete ( emptyList ()) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( empty Array (), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġuser Ġclicks ĠOK Ġbutton Ġon Ġinput Ġstate Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getResult Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . PLAY BACK _ STATE , Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getResult Action ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ verify ( music Controller ). play From Search ( query ) Ċ ĉ } ĊĊ ĉ @ Suppress (" Deferred Result Unused ") Ċ ĉ @ Test Ċ ĉ fun Ġtest Search _ Ok Button Clicked _ Empty SearchResults _ Spot ify Music App () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) ĊĊĉ ĉ // Ġprepare Ġresults Ċĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ġbrowse Results Ġ} Ċĉ ĉ val Ġsearch Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . search Async ( any OrNull ())) Ġdo Answer Ġ{ Ġsearch Results Ġ} ĊĊĉ ĉ wh enever ( music Controller . current App Info ). do Return ( Ċĉĉĉ ĉ Music App Info (" Spot ify ", Ġmock (), Ġ" package ", Ġ" class "). apply Ġ{ Ġsearch able Ġ= Ġtrue } Ċĉ ĉ ) ĊĊĉ ĉ // Ġdisplay Ġbrowse Ġpage Ġhome Ċĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () ĊĊĉ ĉ // Ġthen Ġfinish Ġloading Ġbrowse Ċĉ ĉ browse Results . complete ( listOf Ġ( Ċĉĉĉ ĉ Music Metadata (" test Id 1 ", Ġtitle Ġ= Ġ" Browse ĠItem ĠTitle ", ĉ browse able Ġ= Ġfalse , Ġplay able Ġ= Ġtrue ), Ċĉ ĉ )) ĊĊĉ ĉ // Ġclicking Ġthe Ġsearch Ġaction Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . INPUT _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) ĊĊĉ ĉ // Ġsearch Ġwith Ġa Ġquery Ċĉ ĉ val Ġquery Ġ= Ġ" query " Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġquery )) Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller , Ġtimes ( 1 )). search Async ( query ) Ġ} ĊĊĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ("< Searching > ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġsearch Ġresults Ġfinished Ġloading Ċĉ ĉ search Results . complete ( emptyList ()) Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( empty Array (), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġuser Ġclicks ĠOK Ġbutton Ġon Ġinput Ġstate Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getResult Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( null , Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getResult Action ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ verify ( music Controller , Ġnever ()). play From Search ( query ) Ċ ĉ } ĊĊ ĉ @ Suppress (" Deferred Result Unused ") Ċ ĉ @ Test Ċ ĉ fun Ġtest Search Timeout () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) Ċĉ ĉ val Ġinput Component Ġ= Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input () !! ĊĊĉ ĉ val Ġsearch Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . search Async ( any OrNull ())) Ġdo Answer Ġ{ Ġsearch Results Ġ} ĊĊĉ ĉ browse View . page Controller . open Search Input ( null ) ĊĊĉ ĉ input Component . getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġ" mar io ")) Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller , Ġtimes ( 1 )). search Async ( any ()) Ġ} ĊĊĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ("< Searching > ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } Ċĉ ĉ // Ġverifies Ġthat Ġthe ĠSearch ing Ġentry Ġisn 't Ġclick able Ċĉ ĉ mock Server . data . remove ( input Component . get Suggest Action ()?. as H MI Action ()?. target Model ) Ċĉ ĉ try Ġ{ Ċĉĉ ĉ input Component . get Suggest Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 . to Byte () Ġto Ġ 1 )) Ċĉĉ ĉ fail () Ċĉ ĉ } Ġcatch Ġ( e : ĠR H MI Action Abort ) Ġ{ Ġ// Ġdon 't Ġsucceed Ġthe ĠRA Action Ċĉ ĉ } Ċĉ ĉ assertEquals ( 0 , Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as H MI Action ()?. getTarget Model ()?. as Ra Int Model ()?. value ) ĊĊĉ ĉ // Ġverify Ġthat Ġit Ġretries Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller , Ġtimes ( 2 )). search Async ( any ()) Ġ} Ċĉ ĉ // Ġverify Ġthat Ġit Ġtimes Ġout Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertArrayEquals ( array Of ( array Of ("< Empty > ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) Ċĉ ĉ } ĊĊĉ ĉ // Ġverifies Ġthat Ġthe ĠEmpty Ġentry Ġisn 't Ġclick able Ċĉ ĉ mock Server . data . remove ( input Component . get Suggest Action ()?. as H MI Action ()?. target Model ) Ċĉ ĉ try Ġ{ Ċĉĉ ĉ input Component . get Suggest Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 0 . to Byte () Ġto Ġ 1 )) Ċĉĉ ĉ fail () Ċĉ ĉ } Ġcatch Ġ( e : ĠR H MI Action Abort ) Ġ{ Ġ// Ġdon 't Ġsucceed Ġthe ĠRA Action Ċĉ ĉ } Ċĉ ĉ assertEquals ( 0 , Ġinput Component . get Suggest Action ()?. as H MI Action ()?. getTarget Model ()?. as Ra Int Model ()?. value ) Ċ ĉ } ĊĊ ĉ @ Suppress (" Deferred Result Unused ") Ċ ĉ @ Test Ċ ĉ fun Ġtest Play From Search () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġbrowse View Ġ= ĠB rowse View ( listOf ( app . states [ IDs . BROW SE 1 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 2 _ STATE ] !! , Ġapp . states [ IDs . BROW SE 3 _ STATE ] !! ), Ġmusic Controller , ĠMusic Image IDs Mult imedia , Ġgraphics Helpers ) Ċĉ ĉ browse View . init Widgets ( playback View , Ġapp . states [ IDs . INPUT _ STATE ] !! ) ĊĊĉ ĉ // Ġprepare Ġresults Ċĉ ĉ val Ġbrowse Results Ġ= ĠComp letable Deferred < List < Music Metadata >>() Ċĉ ĉ wh enever ( music Controller . browse Async ( any OrNull ())) Ġdo Answer Ġ{ Ġbrowse Results Ġ} Ċĉ ĉ val Ġsearch Results Ġ= ĠComp letable Deferred < List < Music Metadata >> (). apply Ġ{ complete ( LinkedList ()) } Ċĉ ĉ wh enever ( music Controller . search Async ( any OrNull ())) Ġdo Answer Ġ{ Ġsearch Results Ġ} ĊĊĉ ĉ // Ġpret end Ġthat Ġthe Ġapp Ġisn 't Ġsearch able Ċĉ ĉ wh enever ( music Controller . current App Info ) Ġdo Return ĠMusic App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class ") Ċĉ ĉ val Ġpage 1 Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 . show () ĊĊĉ ĉ // Ġwait Ġfor Ġthe Ġloading Ġscreen Ġto Ġshow Ġup Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ M US IC _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. total Rows ) Ċĉ ĉ } Ċĉ ĉ assertEquals ( 1 , Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). total Rows ) ĠĠĠ Ġ// Ġshould Ġnot Ġshow ĠFilter Ċĉ ĉ assertArrayEquals ( array Of ( array Of ("", Ġ"", Ġ" Filter ")), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data ) ĊĊĉ ĉ // Ġnow Ġpret end Ġthat Ġthe Ġapp ĠIS Ġsearch able Ċĉ ĉ wh enever ( music Controller . is Supported Action ( Music Action . PLAY _ FROM _ SEARCH )) Ġdo Return Ġtrue Ċĉ ĉ browse View . stack . clear () Ċĉ ĉ page 1 . hide () ĊĊĉ ĉ val Ġpage 1 Again Ġ= Ġbrowse View . push Browse Page ( null ) Ċĉ ĉ page 1 Again . show () Ċĉ ĉ assertEquals ( 2 , Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). total Rows ) ĠĠĠ Ġ// Ġshould Ġshow ĠSearch Ġand ĠFilter Ċĉ ĉ assertArrayEquals ( array Of ( array Of ("", Ġ"", Ġ" Search "), ĠarrayOf ("", Ġ"", Ġ" Filter ")), Ġ( mock Server . data [ IDs . BROW SE 1 _ ACTION S _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data ) ĊĊĉ ĉ // Ġtry Ġclicking Ġthe Ġaction Ċĉ ĉ app . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . INPUT _ STATE , Ġapp . components [ IDs . BROW SE 1 _ ACTION S _ COMPONENT ]?. asList ()?. getAction ()?. as H MI Action ()?. getTarget State ()?. id ) ĊĊĉ ĉ // Ġenter Ġa Ġquery Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 8 . to Byte () Ġto Ġ" mar io ")) Ċĉ ĉ await (). until Assert ed Ġ{ Ġverify ( music Controller ). search Async ( any ()) Ġ} ĊĊĉ ĉ // Ġsearch Ġresults Ġshould Ġshow Ġthe ĠPlay ĠFrom ĠSearch Ġoption Ċĉ ĉ await (). until Assert ed Ġ{ Ċĉĉ ĉ assertNotNull ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) Ċĉ ĉ } Ċĉ ĉ assertArrayEquals ( array Of ( array Of (" Play ĠFrom ĠSearch ")), Ġ( mock Server . data [ IDs . INPUT _ SU G GEST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ?) ?. data ) ĊĊĉ ĉ // Ġtry Ġclicking Ġthe Ġoption Ċĉ ĉ app . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( 1 . to Byte () Ġto Ġ 0 )) Ċĉ ĉ assertEquals ( IDs . PLAY BACK _ STATE , Ġapp . components [ IDs . INPUT _ COMPONENT ]?. as Input ()?. get Suggest Action ()?. as H MI Action ()?. getTarget State ()?. id ) Ċĉ ĉ verify ( music Controller ). play From Search (" mar io ") Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Custom Actions () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ val Ġapp Ġ= ĠR H MI Application Et ch ( mock Server , Ġ 1 ) Ċĉ ĉ app . load From XML ( car App Resources . get Ui Description ()?. read Bytes () Ġas ĠByteArray ) Ċĉ ĉ val Ġplayback View Ġ= ĠPlay back View ( app . states [ IDs . PLAY BACK _ STATE ] !! , Ġmusic Controller , Ġmap Of (), Ġphone App Resources , Ġgraphics Helpers , ĠMusic Image IDs Mult imedia ) Ċĉ ĉ val Ġaction View Ġ= ĠCustom Actions View ( app . states [ IDs . ACTION _ STATE ] !! , Ġgraphics Helpers , Ġmusic Controller ) Ċĉ ĉ action View . init Widgets ( playback View ) ĊĊĉ ĉ wh enever ( music Controller . get Custom Actions ()) Ġdo Return ĠlistOf ( Custom Action ( Ċĉĉĉ ĉ " packageName ", Ġ" action Name ", Ġ" Custom ĠName ", Ġnull , Ġnull Ċĉ ĉ )) Ċĉ ĉ action View . show () Ċĉ ĉ verify ( music Controller ). get Custom Actions () ĊĊĉ ĉ assertArrayEquals ( array Of ( array Of ("", Ġ"", Ġ" Custom ĠName ")), Ġ( mock Server . data [ IDs . ACTION _ LIST _ MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data ) Ċĉ ĉ app . components [ IDs . ACTION _ LIST _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( Ċĉĉĉĉ 1 . to Byte () Ġto Ġ 1 Ċĉ ĉ )) Ċĉ ĉ verify ( music Controller , Ġnever ()). custom Action ( any ()) Ċĉ ĉ app . components [ IDs . ACTION _ LIST _ COMPONENT ]?. asList ()?. getAction ()?. as RA Action ()?. rh mi Action Callback ?. on ActionEvent ( map Of ( Ċĉĉĉĉ 1 . to Byte () Ġto Ġ 0 Ċĉ ĉ )) Ċĉ ĉ verify ( music Controller ). custom Action ( Custom Action ( Ċĉĉĉ ĉ " packageName ", Ġ" action Name ", Ġ" Custom ĠName ", Ġnull , Ġnull Ċĉ ĉ )) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġtest Music Sessions () Ġ{ Ċĉ ĉ val Ġmock Server Ġ= ĠMock BM WR em oting Server () Ċĉ ĉ ID rive Connection . mock Remoting Server Ġ= Ġmock Server Ċĉ ĉ val Ġapp Ġ= ĠMusic App ( i Drive Connection Status , Ġsecurity Access , Ġcar App Resources , ĠMusic Image IDs Mult imedia , Ġphone App Resources , Ġgraphics Helpers , Ġmusic App Discovery , Ġmusic Controller , Ġmock ()) Ċĉ ĉ val Ġmock Client Ġ= ĠID rive Connection . mock Remoting Client Ġas ĠBM WR em oting Client ĊĊĉ ĉ val Ġdiscovery Listener Capture Ġ= Ġargument Captor < Runnable >() Ċĉ ĉ verify ( music App Discovery ). listener Ġ= Ġdiscovery Listener Capture . capture () Ċĉ ĉ verify ( music App Discovery , Ġat Least Once ()). discover Apps () Ġ// Ġdiscover Ġapps Ġwhen Ġit Ġstarts Ġup ĊĊĉ ĉ // Ġtell Ġthe Ġapp Ġabout Ġthe Ġcurrent Ġlist Ġof Ġapps , Ġwithout Ġshowing Ġthe Ġapp Ġlist Ċĉ ĉ wh enever ( music App Discovery . valid Apps ) Ġdo Answer Ġ{ Ċĉĉ ĉ listOf ( Music App Info (" Test 1 ", Ġmock (), Ġ" package ", Ġ" class "), Ċĉĉĉĉ ĉ Music App Info (" Test 2 ", Ġmock (), Ġ" package ", Ġ" class ")) Ċĉ ĉ } Ċĉ ĉ discovery Listener Capture . last Value . run () Ċĉ ĉ assertNull (" Did n 't Ġsend Ġan Ġapp Ġlist Ġto Ġthe Ġcar ", Ġmock Server . data [ IDs . APP LIST _ LIST MODEL ]) ĊĊĉ ĉ // Ġshow Ġthe Ġapp Ġlist Ċĉ ĉ mock Client . rh mi _ on H mi Event ( 1 , Ġ" unused ", ĠIDs . APP LIST _ STATE , Ġ 1 , Ġmap Of ( 4 . to Byte () Ġto Ġtrue )) Ċĉ ĉ verify ( music App Discovery , Ġat Least Once ()). discover Apps Async () Ġ// Ġdiscover Ġapps Ġwhen Ġthe ĠApp ĠList Ġis Ġshown Ċĉ ĉ val Ġdisplayed Names Ġ= Ġ( mock Server . data [ IDs . APP LIST _ LIST MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉ ĉ it [ 2 ] Ċĉ ĉ } Ċĉ ĉ assertEquals (" Updates Ġthe Ġapp Ġlist Ġin Ġthe Ġcar ", ĠlistOf (" Test 1 ", Ġ" Test 2 "), Ġdisplayed Names ) ĊĊĉ ĉ // Ġadd Ġa Ġnew Ġapp Ġto Ġthe Ġlist Ċĉ ĉ wh enever ( music App Discovery . valid Apps ) Ġdo Answer Ġ{ Ċĉĉ ĉ listOf ( Music App Info (" Test 1 ", Ġmock (), Ġ" package ", Ġ" class "), Ċĉĉĉĉ ĉ Music App Info (" Test 3 ", Ġmock (), Ġ" package 3 ", Ġ" class ")) Ċĉ ĉ } Ċĉ ĉ discovery Listener Capture . last Value . run () Ċĉ ĉ val Ġdisplayed Names New Ġ= Ġ( mock Server . data [ IDs . APP LIST _ LIST MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . map Ġ{ Ċĉĉ ĉ it [ 2 ] Ċĉ ĉ } Ċĉ ĉ assertEquals (" Updates Ġthe Ġapp Ġlist Ġin Ġthe Ġcar ", ĠlistOf (" Test 1 ", Ġ" Test 3 "), Ġdisplayed Names New ) Ċĉ ĉ ( mock Server . data [ IDs . APP LIST _ LIST MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data . forEach Ġ{ Ġrow Ġ-> Ċĉĉ ĉ assertEquals (" No Ġcheckbox Ġin Ġapp Ġlist ", Ġ"", Ġrow [ 0 ]) Ċĉ ĉ } ĊĊĉ ĉ // Ġa Ġnew Ġmusic Ġapp Ġstarts Ġplaying , Ġwhich Ġwe Ġdon 't Ġknow Ġabout Ċĉ ĉ val Ġnow Playing App Ġ= ĠMusic App Info (" Test 4 ", Ġmock (), Ġ" package 4 ", Ġ" UNUSED ") Ċĉ ĉ wh enever ( music Controller . music Sessions ) Ġdo Answer Ġ{ Ċĉĉ ĉ mock < Music Sessions > Ġ{ Ċĉĉĉ ĉ on Ġ{ Ġget Playing App () Ġ} Ġdo Return Ġnow Playing App Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ discovery Listener Capture . last Value . run () Ċĉ ĉ verify ( music Controller , Ġtimes ( 2 )). connect App Autom atically ( same ( now Playing App )) Ċĉ ĉ // Ġasync Ġsets Ġthe Ġmusic Browser Ġto Ġthe Ġcorrect Ġconnection Ċĉ ĉ wh enever ( music Controller . current App Info ). do Return ( now Playing App ) Ċĉ ĉ wh enever ( music App Discovery . valid Apps ) Ġdo Answer Ġ{ Ċĉĉ ĉ listOf ( Music App Info (" Test 1 ", Ġmock (), Ġ" package ", Ġ" class "), Ċĉĉĉĉ ĉ Music App Info (" Test 3 ", Ġmock (), Ġ" package 3 ", Ġ" class "), Ċĉĉĉĉ ĉ Music App Info (" Test 4 ", Ġmock (), Ġ" package 4 ", Ġnull )) Ċĉ ĉ } Ċĉ ĉ app . redraw () Ċĉ ĉ assertNot Equals (" Sets Ġthe Ġcheckbox Ġin Ġthe Ġapp Ġlist ", Ġ"", Ġ( mock Server . data [ IDs . APP LIST _ LIST MODEL ] Ġas ĠBM WR em oting . RH MI DataTable ). data [ 2 ][ 0 ]) ĊĊĉ ĉ // Ġa Ġnew Ġmusic Ġsession Ġthat Ġwe Ġknow Ġcan Ġbrowse Ġopens Ġup Ċĉ ĉ reset ( music Controller ) Ċĉ ĉ wh enever ( music Controller . music Sessions ) Ġdo Answer Ġ{ Ċĉĉ ĉ mock < Music Sessions > Ġ{ Ċĉĉĉ ĉ on Ġ{ Ġget Playing App () Ġ} Ġdo Return Ġnow Playing App Ċĉĉ ĉ } Ċĉ ĉ } Ċĉ ĉ val Ġbrowse able App Ġ= ĠMusic App Info (" Test 4 ", Ġmock (), Ġ" package 4 ", Ġ" class ") Ċĉ ĉ wh enever ( music App Discovery . valid Apps ) Ġdo Answer Ġ{ Ċĉĉ ĉ listOf ( Music App Info (" Test 1 ", Ġmock (), Ġ" package ", Ġ" class "), Ċĉĉĉĉ ĉ browse able App ) Ċĉ ĉ } Ċĉ ĉ discovery Listener Capture . last Value . run () Ċĉ ĉ verify ( music Controller ). connect App Autom atically ( same ( browse able App )) Ċ ĉ } Ċ }