■ ■ ■ ■ ■ ■
container/container_test.go
skipped 1003 lines 1004 1004 }, 1005 1005 }, 1006 1006 { 1007 + desc: "sets border title on root container of different color", 1008 + termSize: image.Point{10, 10}, 1009 + container: func(ft *faketerm.Terminal) (*Container, error) { 1010 + return New( 1011 + ft, 1012 + Border(linestyle.Light), 1013 + BorderTitle("Ab"), 1014 + BorderColor(cell.ColorRed), 1015 + FocusedColor(cell.ColorBlue), 1016 + TitleColor(cell.ColorMagenta), 1017 + TitleFocusedColor(cell.ColorCyan), 1018 + SplitVertical( 1019 + Left( 1020 + Border(linestyle.Light), 1021 + ), 1022 + Right( 1023 + Border(linestyle.Light), 1024 + ), 1025 + ), 1026 + ) 1027 + }, 1028 + want: func(size image.Point) *faketerm.Terminal { 1029 + ft := faketerm.MustNew(size) 1030 + cvs := testcanvas.MustNew(ft.Area()) 1031 + testdraw.MustBorder( 1032 + cvs, 1033 + image.Rect(0, 0, 10, 10), 1034 + draw.BorderCellOpts(cell.FgColor(cell.ColorBlue)), 1035 + ) 1036 + testdraw.MustBorder( 1037 + cvs, 1038 + image.Rect(1, 1, 5, 9), 1039 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)), 1040 + ) 1041 + testdraw.MustBorder( 1042 + cvs, 1043 + image.Rect(5, 1, 9, 9), 1044 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)), 1045 + ) 1046 + testdraw.MustText( 1047 + cvs, 1048 + "Ab", 1049 + image.Point{1, 0}, 1050 + draw.TextCellOpts(cell.FgColor(cell.ColorCyan)), 1051 + ) 1052 + testcanvas.MustApply(cvs, ft) 1053 + return ft 1054 + }, 1055 + }, 1056 + { 1057 + desc: "sets different color title on left child container", 1058 + termSize: image.Point{10, 10}, 1059 + container: func(ft *faketerm.Terminal) (*Container, error) { 1060 + return New( 1061 + ft, 1062 + Border(linestyle.Light), 1063 + BorderColor(cell.ColorRed), 1064 + FocusedColor(cell.ColorBlue), 1065 + SplitVertical( 1066 + Left( 1067 + Border(linestyle.Light), 1068 + BorderTitle("Ab"), 1069 + TitleColor(cell.ColorMagenta), 1070 + TitleFocusedColor(cell.ColorCyan), 1071 + ), 1072 + Right( 1073 + Border(linestyle.Light), 1074 + ), 1075 + ), 1076 + ) 1077 + }, 1078 + want: func(size image.Point) *faketerm.Terminal { 1079 + ft := faketerm.MustNew(size) 1080 + cvs := testcanvas.MustNew(ft.Area()) 1081 + testdraw.MustBorder( 1082 + cvs, 1083 + image.Rect(0, 0, 10, 10), 1084 + draw.BorderCellOpts(cell.FgColor(cell.ColorBlue)), 1085 + ) 1086 + testdraw.MustBorder( 1087 + cvs, 1088 + image.Rect(1, 1, 5, 9), 1089 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)), 1090 + ) 1091 + testdraw.MustBorder( 1092 + cvs, 1093 + image.Rect(5, 1, 9, 9), 1094 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)), 1095 + ) 1096 + testdraw.MustText( 1097 + cvs, 1098 + "Ab", 1099 + image.Point{2, 1}, 1100 + draw.TextCellOpts(cell.FgColor(cell.ColorMagenta)), 1101 + ) 1102 + testcanvas.MustApply(cvs, ft) 1103 + return ft 1104 + }, 1105 + }, 1106 + { 1107 + desc: "inherits the border color for the title on left child container when TitleColor is not set", 1108 + termSize: image.Point{10, 10}, 1109 + container: func(ft *faketerm.Terminal) (*Container, error) { 1110 + return New( 1111 + ft, 1112 + Border(linestyle.Light), 1113 + BorderColor(cell.ColorRed), 1114 + FocusedColor(cell.ColorBlue), 1115 + SplitVertical( 1116 + Left( 1117 + Border(linestyle.Light), 1118 + BorderTitle("Ab"), 1119 + ), 1120 + Right( 1121 + Border(linestyle.Light), 1122 + ), 1123 + ), 1124 + ) 1125 + }, 1126 + want: func(size image.Point) *faketerm.Terminal { 1127 + ft := faketerm.MustNew(size) 1128 + cvs := testcanvas.MustNew(ft.Area()) 1129 + testdraw.MustBorder( 1130 + cvs, 1131 + image.Rect(0, 0, 10, 10), 1132 + draw.BorderCellOpts(cell.FgColor(cell.ColorBlue)), 1133 + ) 1134 + testdraw.MustBorder( 1135 + cvs, 1136 + image.Rect(1, 1, 5, 9), 1137 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)), 1138 + ) 1139 + testdraw.MustBorder( 1140 + cvs, 1141 + image.Rect(5, 1, 9, 9), 1142 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)), 1143 + ) 1144 + testdraw.MustText( 1145 + cvs, 1146 + "Ab", 1147 + image.Point{2, 1}, 1148 + draw.TextCellOpts(cell.FgColor(cell.ColorRed)), 1149 + ) 1150 + testcanvas.MustApply(cvs, ft) 1151 + return ft 1152 + }, 1153 + }, 1154 + { 1007 1155 desc: "splitting a container removes the widget", 1008 1156 termSize: image.Point{10, 10}, 1009 1157 container: func(ft *faketerm.Terminal) (*Container, error) { skipped 1899 lines