Codebase list ruby-fxruby / c6b411d
Avoid Segfauls in lots of methods when called with nil instead of FXApp, FXComposite or FXWindow objects Lars Kanis 11 years ago
10 changed file(s) with 44 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
463463 * Run popup menu while shown, until stop() or stopModal() is called.
464464 * Also returns when entering previous cascading popup menu.
465465 */
466 FXint runPopup(FXWindow* window);
466 FXint runPopup(FXWindow* owner);
467467
468468 /// True if the window is modal
469469 bool isModal(FXWindow* window) const;
5252 public:
5353
5454 /// Construct splash window
55 FXSplashWindow(FXApp* ap,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXuint ms=5000);
55 FXSplashWindow(FXApp* a,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXuint ms=5000);
5656
5757 /// Construct splash window
58 FXSplashWindow(FXWindow* ow,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXuint ms=5000);
58 FXSplashWindow(FXWindow* own,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXuint ms=5000);
5959
6060 /// Set the icon for the splash window
6161 void setIcon(FXIcon* ic);
2323
2424 %apply Pointer NONNULL {
2525 FXApp* APP,
26 FXComposite* PARENT,
27 FXWindow* OWNER
26 FXApp* a,
27 FXApp* app,
28 FXApp* application,
29 FXComposite* PARENT,
30 FXComposite* p,
31 FXWindow* OWNER,
32 FXWindow* own,
33 FXWindow* owner
2834 }
2935
3036 /* Type-checking rules */
2020
2121 def setup
2222 super(self.class.name)
23 end
24
25 def test_nil_window_raises_argument_error
26 assert_raise(ArgumentError){ app.runPopup(nil) }
2327 end
2428
2529 def check_events(pipe_rd, pipe_wr)
77 def setup
88 super("TC_FXButton")
99 @button = FXButton.new(mainWindow, "buttonText")
10 end
11
12 def test_nil_parent_raises_argument_error
13 assert_raise(ArgumentError){ FXButton.new(nil, "buttonText") }
1014 end
1115
1216 def testText
99 vis = FXGLVisual.new(app, VISUAL_DOUBLEBUFFER)
1010 @viewer = FXGLViewer.new(mainWindow, vis)
1111 end
12
13 def test_supported
14 assert FXGLVisual.supported?(app)
15 end
16
17 def test_nil_app_raises_argument_error
18 assert_raise(ArgumentError){ FXGLVisual.supported?(nil) }
19 end
20
1221 =begin
1322 def test_readPixels
1423 pixels = @viewer.readPixels(0, 0, @viewer.width, @viewer.height)
66
77 def setup
88 super(self.class.name)
9 end
10
11 def test_nil_app_raises_argument_error
12 assert_raise(ArgumentError){ FXMessageBox.new(nil, "Save?", "Save?", :opts => MBOX_SAVE_CANCEL_DONTSAVE) }
913 end
1014
1115 def test_construct_with_save_cancel_dontsave
77 def setup
88 super(self.class.name)
99 @scrollArea = FXScrollArea.new(mainWindow)
10 end
11
12 def test_nil_parent_raises_argument_error
13 assert_raise(ArgumentError){ FXScrollArea.new(nil) }
1014 end
1115
1216 def test_position_get
1414 @mainWin = FXMainWindow.new(@app, 'TC_FXShell')
1515 end
1616
17 def test_nil_parent_raises_argument_error
18 assert_raise(ArgumentError){ FXShell.new(nil, 0, 0, 0, 0, 0) }
19 end
20
1721 def test_new
1822 # Free-floating
1923 shell1 = FXShell.new(@app, 0, 0, 0, 0, 0)
1414 @mainWin = FXMainWindow.new(@app, 'TC_FXButton')
1515 end
1616
17 def test_nil_app_raises_argument_error
18 assert_raise(ArgumentError){ FXTopWindow.new(nil, 'TC_FXButton') }
19 end
20
1721 def test_new
1822 # Free-floating
1923 top1 = FXTopWindow.new(@app, "top1", nil, nil, DECOR_ALL, 0, 0, 0, 0,