@@ -1017,6 +1017,21 @@ def test_radio_buttons(fig_test, fig_ref):
1017
1017
ax .text (.25 , 1 / 3 , "coffee" , transform = ax .transAxes , va = "center" )
1018
1018
1019
1019
1020
+ @check_figures_equal (extensions = ['png' ])
1021
+ def test_radio_buttons_props (fig_test , fig_ref ):
1022
+ label_props = {'color' : ['red' ], 'fontsize' : [24 ]}
1023
+ radio_props = {'facecolor' : 'green' , 'edgecolor' : 'blue' , 'linewidth' : 2 }
1024
+
1025
+ widgets .RadioButtons (fig_ref .subplots (), ['tea' , 'coffee' ],
1026
+ label_props = label_props , radio_props = radio_props )
1027
+
1028
+ cb = widgets .RadioButtons (fig_test .subplots (), ['tea' , 'coffee' ])
1029
+ cb .set_label_props (label_props )
1030
+ # Setting the label size automatically increases default marker size, so we
1031
+ # need to do that here as well.
1032
+ cb .set_radio_props ({** radio_props , 's' : (24 / 2 )** 2 })
1033
+
1034
+
1020
1035
@check_figures_equal (extensions = ["png" ])
1021
1036
def test_check_buttons (fig_test , fig_ref ):
1022
1037
widgets .CheckButtons (fig_test .subplots (), ["tea" , "coffee" ], [True , True ])
@@ -1029,6 +1044,29 @@ def test_check_buttons(fig_test, fig_ref):
1029
1044
ax .text (.25 , 1 / 3 , "coffee" , transform = ax .transAxes , va = "center" )
1030
1045
1031
1046
1047
+ @check_figures_equal (extensions = ['png' ])
1048
+ def test_check_button_props (fig_test , fig_ref ):
1049
+ label_props = {'color' : ['red' ], 'fontsize' : [24 ]}
1050
+ frame_props = {'facecolor' : 'green' , 'edgecolor' : 'blue' , 'linewidth' : 2 }
1051
+ check_props = {'facecolor' : 'red' , 'linewidth' : 2 }
1052
+
1053
+ widgets .CheckButtons (fig_ref .subplots (), ['tea' , 'coffee' ], [True , True ],
1054
+ label_props = label_props , frame_props = frame_props ,
1055
+ check_props = check_props )
1056
+
1057
+ cb = widgets .CheckButtons (fig_test .subplots (), ['tea' , 'coffee' ],
1058
+ [True , True ])
1059
+ cb .set_label_props (label_props )
1060
+ # Setting the label size automatically increases default marker size, so we
1061
+ # need to do that here as well.
1062
+ cb .set_frame_props ({** frame_props , 's' : (24 / 2 )** 2 })
1063
+ # FIXME: Axes.scatter promotes facecolor to edgecolor on unfilled markers,
1064
+ # but Collection.update doesn't do that (it forgot the marker already).
1065
+ # This means we cannot pass facecolor to both setters directly.
1066
+ check_props ['edgecolor' ] = check_props .pop ('facecolor' )
1067
+ cb .set_check_props ({** check_props , 's' : (24 / 2 )** 2 })
1068
+
1069
+
1032
1070
@check_figures_equal (extensions = ["png" ])
1033
1071
def test_check_buttons_rectangles (fig_test , fig_ref ):
1034
1072
# Test should be removed once .rectangles is removed
0 commit comments