/* Ċ Ġ* ĠCopyright Ġ 2 0 2 1 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ Ċ package Ġandroidx . camera . camera 2 . internal . compat . work around Ċ Ċ import Ġandroid . graphics . Surface Texture Ċ import Ġandroid . hardware . camera 2 . Camera Character istics Ċ import Ġandroid . hardware . camera 2 . params . Stream Configuration Map Ċ import Ġandroid . os . Build Ċ import Ġandroid . util . Size Ċ import Ġandroidx . camera . camera 2 . internal . compat . Camera Character istics Compat Ċ import Ġandroidx . camera . camera 2 . internal . compat . quir k . Cam c order Profile Resolution Qu irk Ċ import Ġandroidx . camera . testing . Cam c order Profile Util . PROFILE _ 2 1 6 0 P Ċ import Ġandroidx . camera . testing . Cam c order Profile Util . PROFILE _ 7 2 0 P Ċ import Ġandroidx . camera . testing . Cam c order Profile Util . RESOL UTION _ 2 1 6 0 P Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Argument Matchers Ċ import Ġorg . mockito . Mockito Ċ import Ġorg . mockito . Mockito .` when ` Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . annotation . Config Ċ import Ġorg . ro bo lectric . annotation . internal . DoNot Instrument Ċ import Ġorg . ro bo lectric . shadow . api . Shadow Ċ import Ġorg . ro bo lectric . shadow s . Shadow Camera Character istics Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ DoNot Instrument Ċ @ Config ( min Sdk Ġ= ĠBuild . VERSION _ CODES . LO L LI POP ) Ċ public Ġclass ĠCam c order Profile Resolution Validator Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġpublic Ġfun Ġno Qu irk _ always Valid () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġvalidator Ġ= ĠCam c order Profile Resolution Validator ( null ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( validator . has Valid Video Resolution ( PROFILE _ 2 1 6 0 P )). isTrue () ĊĠĠĠĠĠĠĠ ĠassertThat ( validator . has Valid Video Resolution ( PROFILE _ 7 2 0 P )). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġpublic Ġfun Ġhas Qu irk _ should Check Supported Resolution s () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcamera Character istics Compat Ġ= Ġcreate Camera Character istics Compat ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsupported Resolution Ġ= ĠarrayOf ( RESOL UTION _ 2 1 6 0 P ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġqu irk Ġ= ĠCam c order Profile Resolution Qu irk ( camera Character istics Compat ) ĊĠĠĠĠĠĠĠ Ġval Ġvalidator Ġ= ĠCam c order Profile Resolution Validator ( quir k ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( validator . has Valid Video Resolution ( PROFILE _ 2 1 6 0 P )). isTrue () ĊĠĠĠĠĠĠĠ ĠassertThat ( validator . has Valid Video Resolution ( PROFILE _ 7 2 0 P )). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġpublic Ġfun Ġnull Profile _ not Valid () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcamera Character istics Compat Ġ= Ġcreate Camera Character istics Compat ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsupported Resolution Ġ= ĠarrayOf ( RESOL UTION _ 2 1 6 0 P ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġqu irk Ġ= ĠCam c order Profile Resolution Qu irk ( camera Character istics Compat ) ĊĠĠĠĠĠĠĠ Ġval Ġvalidator Ġ= ĠCam c order Profile Resolution Validator ( quir k ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( validator . has Valid Video Resolution ( null )). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcreate Camera Character istics Compat ( ĊĠĠĠĠĠĠĠ Ġsupported Resolution : ĠArray < Size > Ġ= Ġempty Array () ĊĠĠĠ Ġ): ĠCamera Character istics Compat Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcharacteristics Ġ= ĠShadow Camera Character istics . new Camera Character istics () ĊĠĠĠĠĠĠĠ Ġval Ġshadow Character istics Ġ= ĠShadow . extract < Shadow Camera Character istics >( character istics ) ĊĊĠĠĠĠĠĠĠ Ġval Ġmock Map Ġ= ĠMockito . mock ( Stream Configuration Map :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠBefore ĠAndroid Ġ 2 3 , Ġuse Ġ{@ link ĠSurface Texture } Ġwill Ġfinally Ġmapped Ġto Ġ 0 x 2 2 Ġin ĊĠĠĠĠĠĠĠ Ġ// ĠStream Configuration Map Ġto Ġretrieve Ġthe Ġoutput Ġsizes Ġinformation . ĊĠĠĠĠĠĠĠ Ġ` when `( mock Map . getOutput Sizes ( Argument Matchers . any < Class < Surface Texture >> ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( supported Resolution ) ĊĠĠĠĠĠĠĠ Ġ` when `( mock Map . getOutput Sizes ( Argument Matchers . any Int ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. thenReturn ( supported Resolution ) ĊĊĠĠĠĠĠĠĠ Ġshadow Character istics . set ( Camera Character istics . SCAL ER _ STREAM _ CONFIGURATION _ MAP , Ġmock Map ) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠCamera Character istics Compat . to Camera Character istics Compat ( character istics ) ĊĠĠĠ Ġ} Ċ } Ċ