Show
Ignore:
Timestamp:
01/23/09 13:30:59 (4 years ago)
Author:
isaisstillalive
Message:
  • parent_resizedで正しくリサイズできるように設定。
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/ruwin/test/ruwin/test_control.rb

    r28893 r28895  
    2626  end 
    2727   
     28  { 
     29    :left_top_width_height     => %w{ 10  10 nil nil  10  10 [[10,10,10,10]] []}, 
     30    :right_bottom_width_height => %w{nil nil  10  10  10  10 [[0,0,10,10]]   [[80,180,10,10]]}, 
     31    :left_top_right_bottom     => %w{ 10  10  10  10 nil nil [[10,10,0,0]]   [[10,10,80,180]]}, 
     32    :all                       => %w{ 10  10  10  10  10  10 [[10,10,10,10]] [[10,10,10,10]]}, 
     33  }.each do |name, (left, top, right, bottom, width, height, expected_default, expected_resized)| 
     34    class_eval <<-"END2" 
     35      def test_new_size_#{name} 
     36        klass = Class.new(Ruwin::Control) 
     37        klass.class_eval <<-'END' 
     38          left #{left} 
     39          top  #{top} 
     40          right  #{right} 
     41          bottom #{bottom} 
     42          width  #{width} 
     43          height #{height} 
     44        END 
     45         
     46        window = HiddenWindow.new 
     47        instance = klass.new(window) 
     48        assert_equal #{expected_default}, instance.move_log 
     49      end 
     50       
     51      def test_parent_resized_#{name} 
     52        klass = Class.new(Ruwin::Control) 
     53        klass.class_eval <<-'END' 
     54          left #{left} 
     55          top  #{top} 
     56          right  #{right} 
     57          bottom #{bottom} 
     58          width  #{width} 
     59          height #{height} 
     60        END 
     61         
     62        window = HiddenWindow.new 
     63        instance = klass.new(window) 
     64        instance.move_log.delete_at 0 
     65         
     66        instance.parent_resized 100, 200 
     67        assert_equal #{expected_resized}, instance.move_log 
     68      end 
     69    END2 
     70  end 
     71   
     72   
     73   
     74   
    2875  %w{left top right bottom width height}.each do |property| 
    2976    class_eval <<-"END" 
     
    3582    END 
    3683  end 
    37    
    38   { 
    39     :nil    => "[]", 
    40     :right  => "[[0, 0, 199, 110]]", 
    41     :bottom => "[[0, 0, 100, 209]]", 
    42   }.each do |property, expected| 
    43     class_eval <<-"END" 
    44       def test_parent_resized_#{property} 
    45         klass = Class.new(Ruwin::Control) 
    46         klass.width  100 
    47         klass.height 110 
    48         #{"klass.#{property} 1" unless property == :nil} 
    49          
    50         window = HiddenWindow.new 
    51         instance = klass.new(window) 
    52         instance.move_log.delete_at 0 
    53          
    54         instance.parent_resized 200, 210 
    55         assert_equal #{expected}, instance.move_log 
    56       end 
    57     END 
    58   end 
    5984end