1# Copyright 2016 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import os.path
16
17import its.caps
18import its.device
19import its.image
20import its.objects
21
22
23def main():
24    """Test capture a burst of full size images is fast enough to not timeout.
25
26       This test verify that entire capture pipeline can keep up the speed
27       of fullsize capture + CPU read for at least some time.
28    """
29    NAME = os.path.basename(__file__).split(".")[0]
30    NUM_TEST_FRAMES = 15
31
32    with its.device.ItsSession() as cam:
33        props = cam.get_camera_properties()
34        props = cam.override_with_hidden_physical_camera_props(props)
35        its.caps.skip_unless(its.caps.backward_compatible(props))
36        req = its.objects.auto_capture_request()
37        caps = cam.do_capture([req]*NUM_TEST_FRAMES)
38
39        cap = caps[0]
40        img = its.image.convert_capture_to_rgb_image(cap, props=props)
41        img_name = "%s.jpg" % (NAME)
42        its.image.write_image(img, img_name)
43
44if __name__ == '__main__':
45    main()
46
47