summaryrefslogtreecommitdiffstats
path: root/tests/unit/screen_ui_test.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move librecovery_ui to a sub-directoryTianjie Xu2019-03-211-2/+2
| | | | | | | | This helps to expose librecovery_ui for device specific RecoveryUi. Bug: 76436783 Test: mma, unit tests pass Change-Id: Ic6c3d301d5833e4a592e6ea9d9d059bc4e4919be
* tests: Temporarily disable ScreenRecoveryUITest tests.Tao Bao2018-12-061-18/+18
| | | | | | | | | | Seems they're racing with SurfaceFlinger in acquiring the display, which occasionally takes down the device and leads to test failures. Bug: 120601844 Test: Run recovery_unit_test on marlin. ScreenRecoveryUITest not triggered. Change-Id: I80b21595247a87fc1f2f95aa68df59f58bdf0257
* minui: GRSurface::Create() computes data_size on its own.Tao Bao2018-11-271-3/+3
| | | | | | | | | | | | | GRSurface::Create() doesn't need to rely on caller specifying the buffer size, as it can compute that info based on the given args. This CL also uses `size_t` for all the parameters in GRSurface::Create(). Test: Run recovery_unit_test on marlin. Test: Build and boot into blueline recovery. `Run graphics test`. Test: Build and boot into blueline charger mode. Change-Id: Idec9381079196abf13553a475006fefcfca10950
* switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn2018-11-151-1/+1
| | | | | | Test: compile Bug: 119313545 Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
* ui: Manage loaded resources with smart pointers.Tao Bao2018-11-051-15/+15
| | | | | | Test: Run recovery_unit_test on marlin. Test: `Run graphics test` on marlin. Change-Id: I8239c3d9fb288f80ee11f615402768ff8ef8ecd0
* tests: Use FRIEND_TEST in ScreenRecoveryUITest.Tao Bao2018-11-011-24/+14
| | | | | Test: Run recovery_unit_test on marlin. Change-Id: I93ec6df8c056b2c485200822f18db0b852595242
* minui: Add a protected GRSurface ctor.Tao Bao2018-10-311-21/+20
| | | | | | | | | This prepares for the removal of the default and copy ctors, by making GRSurface::Create() as the only way to get GRSurface instances. Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Change-Id: I0c34c3f3967e252deb020907c83acbac8a8f36b9
* Merge "ui: Add constness to Draw- functions."Treehugger Robot2018-10-241-9/+9
|\
| * ui: Add constness to Draw- functions.Tao Bao2018-10-231-9/+9
| | | | | | | | | | | | | | | | | | | | These functions take the given GRSurface instances as inputs, which shouldn't be altered. Test: mmma -j bootable/recovery Test: Run recovery_unit_test. Test: `Run graphics test` on marlin. Change-Id: I51bf408e85faae2b497d4f148ab1dec22dd16c93
* | Add a function to construct the GRSurface in testTianjie Xu2018-10-231-3/+14
| | | | | | | | | | | | | | | | | | This fixes the build error as the initializer list no longer work without the proper constructor for c++ class. Bug: 74397117 Test: unit tests pass Change-Id: If3ff508a1a01ad5326413dab8e05bacae8a946c8
* | Add function to show localized rescue party menuTianjie Xu2018-10-231-0/+37
|/ | | | | | | | | | | | | Add a function in screenUI to display the pre-generated graphs for rescue party. If these graphs are not valid, falls back to display the old text strings. Right now we haven't generated the localized graphs yet, so the UI always shows the TextMenu. Bug: 116655889 Test: check rescue party under recovery Change-Id: I0558cb536b659cdc25c8b7946d3a39820935b003
* Implement the graphic menusTianjie Xu2018-10-131-14/+45
| | | | | | | | | | | | | | | | | | As we plan to show localized rescue party dialogs under recovery mode with pre-generated images, it becomes necessary to show the menu headers and items with images. This cl converts the menu class to a interface and derived TextMenu & GraphicMenu classes. And the GraphicMenu uses GRSurfaces* as the menu header and a list of GRSurfaces* as menu items. Moreover, factor out the Draw* functions in the ScreenUI into a separate DrawInterface. Therefore, the Menu class can access these draw functions and use them to implement the DrawHeaders & DrawItems neatly. Bug: 74397117 Test: unittests pass, boot into recovery and check menu Change-Id: I95cee30f3e5eb666eb6fbcdfc873a7260fc177c1
* recovery: Add ability to interrupt UIJerry Zhang2018-07-301-1/+38
| | | | | | | | | | | | | | Normally calling a UI method will block indefinitely until the UI is actually used. This creates a method to interrupt the UI, causing waitKey to return -2. This in turn, will cause ShowMenu to return -2. This allows switching between recovery and fastbootd via usb commands. Test: adb shell /data/nativetest64/recovery_unit_test/recovery_unit_test Bug: 78793464 Change-Id: I4c6c9aa18d79070877841a5c9818acf723fa6096
* tests: Clean up the temporary dirs post-run.Tao Bao2018-07-121-2/+3
| | | | | | | | | | TemporaryDir only deletes empty dirs (not done by its dtor because it tries to keep the temporary files available on error exit). Also change FreeCacheTest::MockFreeSpaceChecker to be static. Test: Run recovery_unit_test on marlin. Check /data/local/tmp post-run. Change-Id: I1bd54eb840e3094b4f22ee84c059eec2998773bf
* tests: Skip ScreenRecoveryUITest on gr_init failure.Tao Bao2018-06-141-1/+38
| | | | | | | | | | | | | | | | | It addresses the ScreenRecoveryUITest failures on gce targets which don't have any graphics backend. Probing for all backend devices in tests could work, but would duplicate codes. This CL relies on the result of gr_init(). As a side effect, it may give false negatives if gr_init() is supposed to work but silently broken. But such issues are beyond ScreenRecoveryUITest's concern, which should be captured by the tests for minui or graphics backends instead. Fixes: 79616356 Test: Run recovery_unit_test on marlin. Test: Run recovery_unit_test on gce. Change-Id: I121aacc61c8a614447509506057ecfd8d86163e4
* ui: join only if joinable.Tao Bao2018-06-061-0/+5
| | | | | | | | The threads in RecoveryUI only get initialized if their Init()s finish successfully. Test: recovery_unit_test on marlin. Change-Id: Ic4b62300a3cbd47887d9f4a90dc26f8a7deab616
* tests: Specify the death test style to avoid flakiness.Tao Bao2018-06-051-0/+2
| | | | | | | | | | | | | | | | | | | As warned below (while running the test), the default death test style (i.e. "fast") doesn't work well in a threaded context, which causes test flakiness (timeout or early exit). [WARNING] external/googletest/googletest/src/gtest-death-test.cc:836:: Death tests use fork(), which is unsafe particularly in a threaded context. For this test, Google Test detected 3 threads. This CL specifies the death test styles to be "threadsafe" for the following death tests. - RangeSetTest.GetBlockNumber - RangeSetTest.file_range - ScreenRecoveryUITest.LoadAnimation_MissingAnimation Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test passes and the above warning is gone. Change-Id: I245bbc09286702d5cb326f878c4391e842b66cc5
* ui: Use std::thread to create input/progress threads.Tao Bao2018-05-221-2/+10
| | | | | | Test: Build and boot into recovery on walleye. Check the long press detection; `Run graphics test`. Change-Id: Ic3e9b0652fc3ff6fb3ad118df5ebb9bb4abda2cd
* wear_ui: Address a TODO regarding {intro,loop}_frames.Tao Bao2018-05-141-3/+53
| | | | | | | Also add tests for LoadAnimation that cover the change. Test: Run `recovery_unit_test` on marlin. Change-Id: I0380a5cdd0d85d55baecf7759eb647b6a9f3a085
* screen_ui: Fix an issue in RTL locale detection.Tao Bao2018-05-091-1/+1
| | | | | | | | | | | | | | | | The CL in [1] moved android.os.RecoverySystem to send the locale argument in well-formed BCP 47 language tags (e.g. "en-US" instead of "en_US"), with the matching changes to recovery code in [2]. However, the one in ScreenRecoveryUI::SetLocale() was missed, which broke RTL locale detection when using new format. [1] commit 38715228 in platform/frameworks/base [2] commit 2078b22e in platform/bootable/recovery Test: Set the locale to "ar-EG". `Run graphics test` under recovery. Check the progress bar. Test: Run recovery_unit_test on marlin. Change-Id: I7c7f5e0725bfb096109c7192c19f3f008e8e47e3
* tests: Add tests for ScreenRecoveryUI.Tao Bao2018-05-091-0/+167
| | | | | | | | | | | | In order to support that, this CL adds Paths::set_resource_dir() to override the default resource dir ("/res/images/") that's only available under recovery. Note that since there're external modules depending on libminui, it adds a separate function of res_set_resource_dir(), instead of requiring the dependency on libotautil for everyone. Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Change-Id: I0a7dcf4476808bea9e634eaffc9676f6cbaf92b7
* Move menu headers/items to std::vector<std::string>.Tao Bao2018-05-031-12/+15
| | | | | | | | | Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test: Build and boot into recovery image on angler. Check the UI that shows menu ('View recovery log', 'Wipe data', 'Run locale test'). Test: Start recovery with '--prompt_and_wipe_data'. Check the UI. Change-Id: If8a4209e0bb4ca64f719f9f9465d3b3589a69cdc
* screen_ui: Merge Menu::Start() into its ctor.Tao Bao2018-05-031-21/+7
| | | | | | | | | | | Since we instantiate a Menu object each time for a given set of header/items, we don't have a use case of re-populating an existing Menu with different data (which is what Menu::Start() does). Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test: Build and boot into recovery image on angler. Check the UI. Change-Id: Iaa2ba9d406ebd74c015e43198c17c5335b38df53
* Factor out a menu class for screen uiTianjie Xu2018-03-241-0/+198
Also consolidate the duplicate codes to draw the menu in ScreenRecoveryUI and WearRecoveryUI. This helps us to support text icons as menu in the future. Bug: 74397117 Test: Check the menu under recovery on bullhead and a wear device. Change-Id: Iba9b646c3828670f0e78a7e07d1a94a44e96bb0b Merged-In: Iba9b646c3828670f0e78a7e07d1a94a44e96bb0b