<s> """<STR_LIT>""" <EOL> testname = "<STR_LIT>" <EOL> __revision__ = "<STR_LIT>" <EOL> from . . import win32structures <EOL> def OverlappingTest ( windows ) : <EOL> "<STR_LIT>" <EOL> bugs = [ ] <EOL> for i , first in enumerate ( windows [ : - <NUM_LIT:1> ] ) : <EOL> first_rect = first . Rectangle ( ) <EOL> if first . ref : <EOL> first_ref_rect = first . ref . Rectangle ( ) <EOL> for second in windows [ i + <NUM_LIT:1> : ] : <EOL> second_rect = second . Rectangle ( ) <EOL> if first . ref and second . ref : <EOL> second_ref_rect = second . ref . Rectangle ( ) <EOL> if first_ref_rect == second_ref_rect and not first_rect == second_rect : <EOL> bugs . append ( ( [ first , second ] , { } , "<STR_LIT>" , <NUM_LIT:0> ) ) <EOL> elif _ContainedInOther ( first_ref_rect , second_ref_rect ) and not _ContainedInOther ( first_rect , second_rect ) : <EOL> bugs . append ( <EOL> ( [ first , second ] , { } , "<STR_LIT>" , <NUM_LIT:0> ) ) <EOL> if _Overlapped ( first_rect , second_rect ) and not _ContainedInOther ( first_rect , second_rect ) and not first_rect == second_rect : <EOL> ovlRect = _OverlapRect ( first_rect , second_rect ) <EOL> isInRef = - <NUM_LIT:1> <EOL> if first . ref and second . ref : <EOL> isInRef = <NUM_LIT:0> <EOL> if _Overlapped ( first_ref_rect , second_ref_rect ) : <EOL> isInRef = <NUM_LIT:1> <EOL> bugs . append ( ( <EOL> [ first , second ] , <EOL> { "<STR_LIT>" : ovlRect } , <EOL> testname , <EOL> isInRef ) ) <EOL> return bugs <EOL> def _ContainedInOther ( rect1 , rect2 ) : <EOL> "<STR_LIT>" <EOL> if rect1 . left >= rect2 . left and rect1 . top >= rect2 . top and rect1 . right <= rect2 . right and rect1 . bottom <= rect2 . bottom : <EOL> return True <EOL> elif rect2 . left >= rect1 . left and rect2 . top >= rect1 . top and rect2 . right <= rect1 . right and rect2 . bottom <= rect1 . bottom : <EOL> return True <EOL> return False <EOL> def _Overlapped ( rect1 , rect2 ) : <EOL> "<STR_LIT>" <EOL> ovlRect = _OverlapRect ( rect1 , rect2 ) <EOL> if ovlRect . left < ovlRect . right and ovlRect . top < ovlRect . bottom : <EOL> return True <EOL> return False <EOL> class OptRect ( object ) : pass <EOL> def _OverlapRect ( rect1 , rect2 ) : <EOL> "<STR_LIT>" <EOL> ovlRect = OptRect ( ) <EOL> ovlRect . left = max ( rect1 . left , rect2 . left ) <EOL> ovlRect . right = min ( rect1 . right , rect2 . right ) <EOL> ovlRect . top = max ( rect1 . top , rect2 . top ) <EOL> ovlRect . bottom = min ( rect1 . bottom , rect2 . bottom ) <EOL> return ovlRect </s>
