示例#1
0
def increase_brightness_GUI (label):
    '''Implement the increase_brightness function from img_manip.'''
    
    #Clear all the temp pics in front of the current pic current_pic
    global temp_label
    global current_pic
    temp_label = temp_label[0:current_pic+1]
    #Implement the function increase_brightness
    label.picture = img_manip.increase_brightness(label.picture)
    #Keep a copy of the current pic for the functions Undo and Redo
    temp_label.append(label.picture)
    current_pic += 1
    #update the label
    update_label(label)
示例#2
0
def test_increase_brightness():
    '''Test the function increase_brightness in img_manip.'''
    
    new_pic = create_pic(4, 4)
    new_pic_increase_bright= img_manip.increase_brightness(new_pic)
    
    #The average brightness of new_pic_increased_brightness will likely not be 
    #exactly 10 more than that of new_pic because some RGB values may already be
    #255 and cannot increase, so the function tests for a difference of 10 with
    #an error of 2 rather than for strict difference of 10.
    
    old_avg_brightness = avg_bright.average_brightness(new_pic)
    new_avg_brightness = avg_bright.average_brightness(new_pic_increase_bright)
    assert new_avg_brightness - old_avg_brightness - 10 < 2, \
           "increase_brightness failed to increase the picture's average \