diff --git a/widget/check_group_test.go b/widget/check_group_test.go
index 584fde8572..d4a586740e 100644
--- a/widget/check_group_test.go
+++ b/widget/check_group_test.go
@@ -1,6 +1,7 @@
package widget_test
import (
+ "fmt"
"testing"
"fyne.io/fyne/v2"
@@ -217,3 +218,111 @@ func TestCheckGroup_ManipulateOptions(t *testing.T) {
assert.Equal(t, 1, len(check.Options))
assert.Equal(t, 0, len(check.Selected))
}
+
+func TestCheckGroup_LayoutColumns(t *testing.T) {
+ lotsofoptions := []string{}
+ for i := 0; i < 50; i++ {
+ lotsofoptions = append(lotsofoptions, fmt.Sprintf("Test %d", i))
+ }
+
+ testmap := map[string]struct {
+ disabled bool
+ horizontal bool
+ options []string
+ selected []string
+ }{
+ "single": {
+ options: []string{"Test"},
+ },
+ "single_disabled": {
+ disabled: true,
+ options: []string{"Test"},
+ },
+ "single_horizontal": {
+ horizontal: true,
+ options: []string{"Test"},
+ },
+ "single_horizontal_disabled": {
+ disabled: true,
+ horizontal: true,
+ options: []string{"Test"},
+ },
+ "single_selected": {
+ options: []string{"Test"},
+ selected: []string{"Test"},
+ },
+ "single_selected_disabled": {
+ disabled: true,
+ options: []string{"Test"},
+ selected: []string{"Test"},
+ },
+ "single_selected_horizontal": {
+ horizontal: true,
+ options: []string{"Test"},
+ selected: []string{"Test"},
+ },
+ "single_selected_horizontal_disabled": {
+ disabled: true,
+ horizontal: true,
+ options: []string{"Test"},
+ selected: []string{"Test"},
+ },
+ "multiple": {
+ options: lotsofoptions,
+ },
+ "multiple_disabled": {
+ disabled: true,
+ options: lotsofoptions,
+ },
+ "multiple_horizontal": {
+ horizontal: true,
+ options: lotsofoptions,
+ },
+ "multiple_horizontal_disabled": {
+ disabled: true,
+ horizontal: true,
+ options: lotsofoptions,
+ },
+ "multiple_selected": {
+ options: lotsofoptions,
+ selected: []string{lotsofoptions[0], lotsofoptions[5]},
+ },
+ "multiple_selected_disabled": {
+ disabled: true,
+ options: lotsofoptions,
+ selected: []string{lotsofoptions[0], lotsofoptions[5]},
+ },
+ "multiple_selected_horizontal": {
+ horizontal: true,
+ options: lotsofoptions,
+ selected: []string{lotsofoptions[0], lotsofoptions[5]},
+ },
+ "multiple_selected_horizontal_disabled": {
+ disabled: true,
+ horizontal: true,
+ options: lotsofoptions,
+ selected: []string{lotsofoptions[0], lotsofoptions[5]},
+ },
+ }
+
+ for _, i := range []int{-2, 2, 5} {
+ for name, tt := range testmap {
+ t.Run(name, func(t *testing.T) {
+ check := &widget.CheckGroup{
+ Horizontal: tt.horizontal,
+ Options: tt.options,
+ Selected: tt.selected,
+ }
+ check.SetColumns(i)
+ if tt.disabled {
+ check.Disable()
+ }
+
+ window := test.NewTempWindow(t, check)
+ window.Resize(check.MinSize().Max(fyne.NewSize(1500, 1500)))
+
+ test.AssertRendersToMarkup(t, fmt.Sprintf("check_group/layout_columns_%d_%s.xml", i, name), window.Canvas())
+ })
+ }
+ }
+}
diff --git a/widget/testdata/check_group/layout_columns_-2_multiple.xml b/widget/testdata/check_group/layout_columns_-2_multiple.xml
new file mode 100644
index 0000000000..8eab8b8c17
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_multiple.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_multiple_disabled.xml b/widget/testdata/check_group/layout_columns_-2_multiple_disabled.xml
new file mode 100644
index 0000000000..873926570d
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_multiple_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_multiple_horizontal.xml b/widget/testdata/check_group/layout_columns_-2_multiple_horizontal.xml
new file mode 100644
index 0000000000..dc3bf63afe
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_multiple_horizontal.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_multiple_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_-2_multiple_horizontal_disabled.xml
new file mode 100644
index 0000000000..591a2a41fb
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_multiple_horizontal_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_multiple_selected.xml b/widget/testdata/check_group/layout_columns_-2_multiple_selected.xml
new file mode 100644
index 0000000000..a7a83a7d56
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_multiple_selected.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_multiple_selected_disabled.xml b/widget/testdata/check_group/layout_columns_-2_multiple_selected_disabled.xml
new file mode 100644
index 0000000000..c0c8ed5f9c
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_multiple_selected_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_multiple_selected_horizontal.xml b/widget/testdata/check_group/layout_columns_-2_multiple_selected_horizontal.xml
new file mode 100644
index 0000000000..24a933ff2a
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_multiple_selected_horizontal.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_multiple_selected_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_-2_multiple_selected_horizontal_disabled.xml
new file mode 100644
index 0000000000..8ba36f913f
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_multiple_selected_horizontal_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_single.xml b/widget/testdata/check_group/layout_columns_-2_single.xml
new file mode 100644
index 0000000000..af2cd3dd1e
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_single.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_single_disabled.xml b/widget/testdata/check_group/layout_columns_-2_single_disabled.xml
new file mode 100644
index 0000000000..a4051cf572
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_single_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_single_horizontal.xml b/widget/testdata/check_group/layout_columns_-2_single_horizontal.xml
new file mode 100644
index 0000000000..af2cd3dd1e
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_single_horizontal.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_single_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_-2_single_horizontal_disabled.xml
new file mode 100644
index 0000000000..a4051cf572
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_single_horizontal_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_single_selected.xml b/widget/testdata/check_group/layout_columns_-2_single_selected.xml
new file mode 100644
index 0000000000..374172e278
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_single_selected.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_single_selected_disabled.xml b/widget/testdata/check_group/layout_columns_-2_single_selected_disabled.xml
new file mode 100644
index 0000000000..ebbfce9bf4
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_single_selected_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_single_selected_horizontal.xml b/widget/testdata/check_group/layout_columns_-2_single_selected_horizontal.xml
new file mode 100644
index 0000000000..374172e278
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_single_selected_horizontal.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_-2_single_selected_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_-2_single_selected_horizontal_disabled.xml
new file mode 100644
index 0000000000..ebbfce9bf4
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_-2_single_selected_horizontal_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_multiple.xml b/widget/testdata/check_group/layout_columns_2_multiple.xml
new file mode 100644
index 0000000000..c5854ff6e4
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_multiple.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_multiple_disabled.xml b/widget/testdata/check_group/layout_columns_2_multiple_disabled.xml
new file mode 100644
index 0000000000..a7e2374e31
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_multiple_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_multiple_horizontal.xml b/widget/testdata/check_group/layout_columns_2_multiple_horizontal.xml
new file mode 100644
index 0000000000..f1ae072027
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_multiple_horizontal.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_multiple_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_2_multiple_horizontal_disabled.xml
new file mode 100644
index 0000000000..e12d1a6fd3
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_multiple_horizontal_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_multiple_selected.xml b/widget/testdata/check_group/layout_columns_2_multiple_selected.xml
new file mode 100644
index 0000000000..611ecad04c
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_multiple_selected.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_multiple_selected_disabled.xml b/widget/testdata/check_group/layout_columns_2_multiple_selected_disabled.xml
new file mode 100644
index 0000000000..1471bec110
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_multiple_selected_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_multiple_selected_horizontal.xml b/widget/testdata/check_group/layout_columns_2_multiple_selected_horizontal.xml
new file mode 100644
index 0000000000..23d8a48984
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_multiple_selected_horizontal.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_multiple_selected_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_2_multiple_selected_horizontal_disabled.xml
new file mode 100644
index 0000000000..aeeb1beacc
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_multiple_selected_horizontal_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_single.xml b/widget/testdata/check_group/layout_columns_2_single.xml
new file mode 100644
index 0000000000..ba223d9c93
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_single.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_single_disabled.xml b/widget/testdata/check_group/layout_columns_2_single_disabled.xml
new file mode 100644
index 0000000000..0be054830e
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_single_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_single_horizontal.xml b/widget/testdata/check_group/layout_columns_2_single_horizontal.xml
new file mode 100644
index 0000000000..eb2d1a4441
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_single_horizontal.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_single_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_2_single_horizontal_disabled.xml
new file mode 100644
index 0000000000..2c971c2bf1
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_single_horizontal_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_single_selected.xml b/widget/testdata/check_group/layout_columns_2_single_selected.xml
new file mode 100644
index 0000000000..94d5228fe2
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_single_selected.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_single_selected_disabled.xml b/widget/testdata/check_group/layout_columns_2_single_selected_disabled.xml
new file mode 100644
index 0000000000..6f3bacac94
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_single_selected_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_single_selected_horizontal.xml b/widget/testdata/check_group/layout_columns_2_single_selected_horizontal.xml
new file mode 100644
index 0000000000..4eaef14559
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_single_selected_horizontal.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_2_single_selected_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_2_single_selected_horizontal_disabled.xml
new file mode 100644
index 0000000000..08fdf63b71
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_2_single_selected_horizontal_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_multiple.xml b/widget/testdata/check_group/layout_columns_5_multiple.xml
new file mode 100644
index 0000000000..79614cbb6e
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_multiple.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_multiple_disabled.xml b/widget/testdata/check_group/layout_columns_5_multiple_disabled.xml
new file mode 100644
index 0000000000..a1f517a169
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_multiple_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_multiple_horizontal.xml b/widget/testdata/check_group/layout_columns_5_multiple_horizontal.xml
new file mode 100644
index 0000000000..d8fc290947
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_multiple_horizontal.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_multiple_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_5_multiple_horizontal_disabled.xml
new file mode 100644
index 0000000000..c0e2a4e367
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_multiple_horizontal_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_multiple_selected.xml b/widget/testdata/check_group/layout_columns_5_multiple_selected.xml
new file mode 100644
index 0000000000..57e998e7fa
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_multiple_selected.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_multiple_selected_disabled.xml b/widget/testdata/check_group/layout_columns_5_multiple_selected_disabled.xml
new file mode 100644
index 0000000000..2019b235a0
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_multiple_selected_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_multiple_selected_horizontal.xml b/widget/testdata/check_group/layout_columns_5_multiple_selected_horizontal.xml
new file mode 100644
index 0000000000..8ad2a17a4b
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_multiple_selected_horizontal.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_multiple_selected_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_5_multiple_selected_horizontal_disabled.xml
new file mode 100644
index 0000000000..5a11b2bd1d
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_multiple_selected_horizontal_disabled.xml
@@ -0,0 +1,306 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_single.xml b/widget/testdata/check_group/layout_columns_5_single.xml
new file mode 100644
index 0000000000..dae66a55f7
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_single.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_single_disabled.xml b/widget/testdata/check_group/layout_columns_5_single_disabled.xml
new file mode 100644
index 0000000000..d5979be390
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_single_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_single_horizontal.xml b/widget/testdata/check_group/layout_columns_5_single_horizontal.xml
new file mode 100644
index 0000000000..544e7f1c69
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_single_horizontal.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_single_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_5_single_horizontal_disabled.xml
new file mode 100644
index 0000000000..313bde2483
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_single_horizontal_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_single_selected.xml b/widget/testdata/check_group/layout_columns_5_single_selected.xml
new file mode 100644
index 0000000000..8e40faa1d0
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_single_selected.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_single_selected_disabled.xml b/widget/testdata/check_group/layout_columns_5_single_selected_disabled.xml
new file mode 100644
index 0000000000..20a478e134
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_single_selected_disabled.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_single_selected_horizontal.xml b/widget/testdata/check_group/layout_columns_5_single_selected_horizontal.xml
new file mode 100644
index 0000000000..84f8cb7786
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_single_selected_horizontal.xml
@@ -0,0 +1,12 @@
+
diff --git a/widget/testdata/check_group/layout_columns_5_single_selected_horizontal_disabled.xml b/widget/testdata/check_group/layout_columns_5_single_selected_horizontal_disabled.xml
new file mode 100644
index 0000000000..9f89c1f0df
--- /dev/null
+++ b/widget/testdata/check_group/layout_columns_5_single_selected_horizontal_disabled.xml
@@ -0,0 +1,12 @@
+