Codebase list ruby-fxruby / 91adbb7
Fix FXGLVisual.supported It did not return an Array as intended, but only true or false. This caused random failures of the test suite. To follow ruby best practice, supported? returns the GL support state (true/false) only. Lars Kanis 6 years ago
4 changed file(s) with 18 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
19751975 end
19761976 class FXGLVisual
19771977 def FXGLVisual.supported?(*args) # :nodoc:
1978 FXGLVisual.supported(*args)
1978 FXGLVisual.supported(*args)[0]
19791979 end
19801980 def redSize(*args) # :nodoc:
19811981 getRedSize(*args)
7676 # even support no OpenGL at all! This function returns the lesser
7777 # of the client support level and the display server support level.
7878 #
79 # Return an array with the following 3 elements: [supported, major, minor]
80 #
81 def FXGLVisual.supported(app); end
82
83 # Test if OpenGL is possible.
84 #
85 # Same as {FXGLVisual.supported?}, but returns the first element (true/false) only.
86 #
7987 def FXGLVisual.supported?(app); end
8088
8189 # Return +true+ if double-buffered
4040 * of the client support level and the display server support level.
4141 */
4242 %extend {
43 static FXbool supported(FXApp* application){
43 static VALUE supported(FXApp* application){
4444 int major,minor;
4545 FXbool answer=FXGLVisual::supported(application,major,minor);
4646 return rb_ary_new3(3,answer?Qtrue:Qfalse,INT2NUM(major),INT2NUM(minor));
1111 end
1212
1313 def test_supported
14 assert FXGLVisual.supported?(app)
14 arr = FXGLVisual.supported(app)
15 assert_equal 3, arr.length, "return array should have elements [support, major, minor]"
16 assert_true arr[0], "OpenGL should be supported"
17 assert_operator 1, :<=, arr[1], "OpenGL should be version 1.0 or greater"
18 end
19
20 def test_supported?
21 assert_true FXGLVisual.supported?(app), "OpenGL should be supported"
1522 end
1623
1724 def test_nil_app_raises_argument_error