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 its.image
16import its.device
17import its.objects
18import os.path
19
20def main():
21    """Test capture a burst of full size images is fast enough to not timeout.
22       This test verify that entire capture pipeline can keep up the speed
23       of fullsize capture + CPU read for at least some time.
24    """
25    NAME = os.path.basename(__file__).split(".")[0]
26    NUM_TEST_FRAMES = 20
27
28    with its.device.ItsSession() as cam:
29        props = cam.get_camera_properties()
30        req = its.objects.auto_capture_request()
31        caps = cam.do_capture([req]*NUM_TEST_FRAMES)
32
33        cap = caps[0]
34        img = its.image.convert_capture_to_rgb_image(cap, props=props)
35        img_name = "%s.jpg" % (NAME)
36        its.image.write_image(img, img_name)
37
38if __name__ == '__main__':
39    main()
40
41