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