/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 2 0 Ġ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 Ġcom . android . tools . idea . emulator . settings Ċ Ċ import Ġcom . android . tools . adt ui . swing . Fake Ui Ċ import Ġcom . android . tools . idea . emulator . Em ulator Settings Ċ import Ġcom . android . tools . idea . emulator . Em ulator Settings . Snapshot Auto Deletion Policy Ċ import Ġcom . android . tools . idea . testing . Android Project Rule Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . intellij . openapi . ui . ComboBox Ċ import Ġcom . intellij . test Framework . Ed t Rule Ċ import Ġcom . intellij . test Framework . Runs In Ed t Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . rules . Rule Chain Ċ import Ġjavax . swing . J CheckBox Ċ Ċ /** Ċ Ġ* ĠTests Ġfor Ġ[ Em ulator Settings Ui ]. Ċ Ġ*/ Ċ @ Runs In Ed t Ċ class ĠEm ulator Settings Ui Test Ġ{ ĊĠ Ġprivate Ġval Ġproject Rule Ġ= ĠAndroid Project Rule . in Memory () ĊĠ Ġ@ get : Rule ĊĠ Ġval Ġrule Chain : ĠRule Chain Ġ= ĠRule Chain . outer Rule ( project Rule ). around ( Ed t Rule ()) ĊĊĠ Ġprivate Ġval Ġsettings ĊĠĠĠ Ġget () Ġ= ĠEm ulator Settings . getInstance () ĊĊĠ Ġ@ Before ĊĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠ Ġsettings . load State ( Em ulator Settings ()) ĊĠ Ġ} ĊĊĠ Ġ@ After ĊĠ Ġfun ĠtearDown () Ġ{ ĊĠĠĠ Ġsettings . load State ( Em ulator Settings ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Settings Ui () Ġ{ ĊĠĠĠ Ġval Ġprovider Ġ= ĠEm ulator Configurable Provider () ĊĠĠĠ ĠassertThat ( provider . can Create Configurable ()). isTrue () ĊĠĠĠ Ġval Ġsettings Ui Ġ= Ġprovider . create Configurable () ĊĠĠĠ Ġval Ġcomponent Ġ= Ġsettings Ui . create Component () !! ĊĠĠĠ Ġval Ġui Ġ= ĠFake Ui ( component ) ĊĠĠĠ Ġval Ġlaunch In Tool Window CheckBox Ġ= Ġui . getComponent < J CheckBox >() ĊĠĠĠ Ġval Ġsnapshot Auto Deletion Policy ComboBox Ġ= Ġui . getComponent < ComboBox < Snapshot Auto Deletion Policy >>() ĊĊĠĠĠ Ġsettings Ui . reset () ĊĊĠĠĠ ĠassertThat ( launch In Tool Window CheckBox . isSelected ). isFalse () ĊĠĠĠ ĠassertThat ( snapshot Auto Deletion Policy ComboBox . selected Item ). isEqualTo ( Snapshot Auto Deletion Policy . ASK _ BEFORE _ DE LET ING ) ĊĠĠĠ ĠassertThat ( snapshot Auto Deletion Policy ComboBox . isEnabled ). isFalse () ĊĠĠĠ ĠassertThat ( settings Ui . is Modified ). isFalse () ĊĊĠĠĠ Ġlaunch In Tool Window CheckBox . isSelected Ġ= Ġtrue ĊĊĠĠĠ ĠassertThat ( settings Ui . is Modified ). isTrue () ĊĠĠĠ ĠassertThat ( snapshot Auto Deletion Policy ComboBox . isEnabled ). isTrue () ĊĊĠĠĠ Ġsnapshot Auto Deletion Policy ComboBox . selected Item Ġ= ĠSnapshot Auto Deletion Policy . DELETE _ AUT OM AT IC ALLY ĊĠĠĠ Ġsettings Ui . apply () ĊĊĠĠĠ ĠassertThat ( settings . launch In Tool Window ). isTrue () ĊĠĠĠ ĠassertThat ( settings . snapshot Auto Deletion Policy ). isEqualTo ( Snapshot Auto Deletion Policy . DELETE _ AUT OM AT IC ALLY ) ĊĠ Ġ} Ċ } Ċ