pyWinAuto: c:\.projects\py_pywinauto\pywinauto\tests\comboboxdroppedheight.py

0001# GUI Application automation and testing library
0002# Copyright (C) 2006 Mark Mc Mahon
0003#
0004# This library is free software; you can redistribute it and/or
0005# modify it under the terms of the GNU Lesser General Public License
0006# as published by the Free Software Foundation; either version 2.1
0007# of the License, or (at your option) any later version.
0008#
0009# This library is distributed in the hope that it will be useful,
0010# but WITHOUT ANY WARRANTY; without even the implied warranty of
0011# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0012# See the GNU Lesser General Public License for more details.
0013#
0014# You should have received a copy of the GNU Lesser General Public
0015# License along with this library; if not, write to the
0016#    Free Software Foundation, Inc.,
0017#    59 Temple Place,
0018#    Suite 330,
0019#    Boston, MA 02111-1307 USA
0020
0021"""ComboBox dropped height Test
0022
0023**What is checked**
0024It is ensured that the height of the list displayed when the combobox is
0025dropped down is not less than the height of the reference.
0026
0027**How is it checked**
0028The value for the dropped rectangle can be retrieved from windows. The height
0029of this rectangle is calculated and compared against the reference height.
0030
0031**When is a bug reported**
0032If the height of the dropped rectangle for the combobox being checked is less
0033than the height of the reference one then a bug is reported.
0034
0035**Bug Extra Information**
0036There is no extra information associated with this bug type
0037
0038**Is Reference dialog needed**
0039The reference dialog is necessary for this test.
0040
0041**False positive bug reports**
0042No false bugs should be reported. If the font of the localised control has a
0043smaller height than the reference then it is possible that the dropped
0044rectangle could be of a different size.
0045
0046**Test Identifier**
0047The identifier for this test/bug is "ComboBoxDroppedHeight"
0048"""
0049__revision__ = "$Revision: 276 $"
0050
0051testname = "ComboBoxDroppedHeight"
0052
0053def ComboBoxDroppedHeightTest(windows):
0054    "Check if each combobox height is the same as the reference"
0055    bugs = []
0056    for win in windows:
0057        if not win.ref:
0058            continue
0059
0060        if win.Class() != "ComboBox" or win.ref.Class() != "ComboBox":
0061            continue
0062
0063        if win.DroppedRect().height() != win.ref.DroppedRect().height():
0064
0065            bugs.append((
0066                [win, ],
0067                {},
0068                testname,
0069                0,)
0070            )
0071
0072    return bugs