diff options
author | Timothy Knight <tknight@google.com> | 2014-07-12 12:49:55 -0700 |
---|---|---|
committer | Timothy Knight <tknight@google.com> | 2014-07-14 21:24:38 +0000 |
commit | 4d35d3aa29f9cf5355af27c3cb8f91dbdbeb2604 (patch) | |
tree | b465dd3ca8292e44179c450a0b4d7b7bb5c485cb /apps/CameraITS/tests/scene1/test_ae_precapture_trigger.py | |
parent | fdfd60aee36376910bacac00426d1b0f22bcfa2b (diff) | |
download | pdk-4d35d3aa29f9cf5355af27c3cb8f91dbdbeb2604.tar.gz |
CameraITS: Added AE precapture trigger test
Change-Id: Ie9d97bafff6a208baf4595f556f4b2dd2eb8ebc0
(cherry picked from commit f892b461024ba6f86637cb9388de7d237ca17a82)
Diffstat (limited to 'apps/CameraITS/tests/scene1/test_ae_precapture_trigger.py')
-rw-r--r-- | apps/CameraITS/tests/scene1/test_ae_precapture_trigger.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/CameraITS/tests/scene1/test_ae_precapture_trigger.py b/apps/CameraITS/tests/scene1/test_ae_precapture_trigger.py new file mode 100644 index 0000000..580012e --- /dev/null +++ b/apps/CameraITS/tests/scene1/test_ae_precapture_trigger.py @@ -0,0 +1,67 @@ +# Copyright 2014 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. + +import its.device +import its.objects +import its.target + +def main(): + """Test the AE state machine when using the precapture trigger. + """ + + INACTIVE = 0 + SEARCHING = 1 + CONVERGED = 2 + LOCKED = 3 + FLASHREQUIRED = 4 + PRECAPTURE = 5 + + with its.device.ItsSession() as cam: + # Capture 5 manual requests, with AE disabled, and the last request + # has an AE precapture trigger (which should be ignored since AE is + # disabled). + manual_reqs = [] + e, s = its.target.get_target_exposure_combos(cam)["midExposureTime"] + manual_req = its.objects.manual_capture_request(s,e) + manual_req['android.control.aeMode'] = 0 # Off + manual_reqs += [manual_req]*4 + precap_req = its.objects.manual_capture_request(s,e) + precap_req['android.control.aeMode'] = 0 # Off + precap_req['android.control.aePrecaptureTrigger'] = 1 # Start + manual_reqs.append(precap_req) + caps = cam.do_capture(manual_reqs) + for cap in caps: + assert(cap['metadata']['android.control.aeState'] == INACTIVE) + + # Capture an auto request and verify the AE state; no trigger. + auto_req = its.objects.auto_capture_request() + auto_req['android.control.aeMode'] = 1 # On + cap = cam.do_capture(auto_req) + state = cap['metadata']['android.control.aeState'] + assert(state in [SEARCHING, CONVERGED]) + + # Capture with auto request with a precapture trigger. + auto_req['android.control.aePrecaptureTrigger'] = 1 # Start + cap = cam.do_capture(auto_req) + state = cap['metadata']['android.control.aeState'] + assert(state in [SEARCHING, CONVERGED, PRECAPTURE]) + + # Capture some more auto requests, and AE should converge. + auto_req['android.control.aePrecaptureTrigger'] = 0 + caps = cam.do_capture([auto_req]*5) + state = caps[-1]['metadata']['android.control.aeState'] + assert(state == CONVERGED) + +if __name__ == '__main__': + main() |