test_3a.py revision 87b68b020dd72c4cdcf3b8c1f9196c060f947991
1# Copyright 2013 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.device
16
17def main():
18    """Basic test for bring-up of 3A.
19
20    Will be updated or removed once 3A is working. Simply calls the function to
21    initiate the 3A intent, and exits. Watch logcat (once the script exits) to
22    see how the 3A operation fared.
23    """
24
25    # TODO: Finish this test
26
27    with its.device.ItsSession() as cam:
28        rect = [0,0,1,1]
29        sens, exp, gains, xform, focus = cam.do_3a(rect, rect, rect)
30        print "AE: sensitivity %d, exposure %dms" % (sens, exp/1000000)
31        print "AWB: gains", gains, "transform", xform
32        print "AF: distance", focus
33        assert(sens > 0)
34        assert(exp > 0)
35        assert(len(gains) == 4)
36        assert(len(xform) == 9)
37
38        # TODO: Uncomment assertion once AF returns the focus distance.
39        #assert(focus > 0)
40
41if __name__ == '__main__':
42    main()
43
44