@@ -856,7 +856,7 @@ func TestSetCellRichText(t *testing.T) {
856
856
Text : "bold" ,
857
857
Font : & Font {
858
858
Bold : true ,
859
- Color : "2354e8 " ,
859
+ Color : "2354E8 " ,
860
860
ColorIndexed : 0 ,
861
861
Family : "Times New Roman" ,
862
862
},
@@ -871,7 +871,7 @@ func TestSetCellRichText(t *testing.T) {
871
871
Text : "italic " ,
872
872
Font : & Font {
873
873
Bold : true ,
874
- Color : "e83723 " ,
874
+ Color : "E83723 " ,
875
875
Italic : true ,
876
876
Family : "Times New Roman" ,
877
877
},
@@ -880,43 +880,43 @@ func TestSetCellRichText(t *testing.T) {
880
880
Text : "text with color and font-family, " ,
881
881
Font : & Font {
882
882
Bold : true ,
883
- Color : "2354e8 " ,
883
+ Color : "2354E8 " ,
884
884
Family : "Times New Roman" ,
885
885
},
886
886
},
887
887
{
888
888
Text : "\r \n large text with " ,
889
889
Font : & Font {
890
890
Size : 14 ,
891
- Color : "ad23e8 " ,
891
+ Color : "AD23E8 " ,
892
892
},
893
893
},
894
894
{
895
895
Text : "strike" ,
896
896
Font : & Font {
897
- Color : "e89923 " ,
897
+ Color : "E89923 " ,
898
898
Strike : true ,
899
899
},
900
900
},
901
901
{
902
902
Text : " superscript" ,
903
903
Font : & Font {
904
- Color : "dbc21f " ,
904
+ Color : "DBC21F " ,
905
905
VertAlign : "superscript" ,
906
906
},
907
907
},
908
908
{
909
909
Text : " and " ,
910
910
Font : & Font {
911
911
Size : 14 ,
912
- Color : "ad23e8 " ,
913
- VertAlign : "BASELINE " ,
912
+ Color : "AD23E8 " ,
913
+ VertAlign : "baseline " ,
914
914
},
915
915
},
916
916
{
917
917
Text : "underline" ,
918
918
Font : & Font {
919
- Color : "23e833 " ,
919
+ Color : "23E833 " ,
920
920
Underline : "single" ,
921
921
},
922
922
},
@@ -937,6 +937,11 @@ func TestSetCellRichText(t *testing.T) {
937
937
})
938
938
assert .NoError (t , err )
939
939
assert .NoError (t , f .SetCellStyle ("Sheet1" , "A1" , "A1" , style ))
940
+
941
+ runs , err := f .GetCellRichText ("Sheet1" , "A1" )
942
+ assert .NoError (t , err )
943
+ assert .Equal (t , richTextRun , runs )
944
+
940
945
assert .NoError (t , f .SaveAs (filepath .Join ("test" , "TestSetCellRichText.xlsx" )))
941
946
// Test set cell rich text on not exists worksheet
942
947
assert .EqualError (t , f .SetCellRichText ("SheetN" , "A1" , richTextRun ), "sheet SheetN does not exist" )
@@ -1153,6 +1158,29 @@ func TestSharedStringsError(t *testing.T) {
1153
1158
})
1154
1159
}
1155
1160
1161
+ func TestSetCellIntFunc (t * testing.T ) {
1162
+ cases := []struct {
1163
+ val interface {}
1164
+ target string
1165
+ }{
1166
+ {val : 128 , target : "128" },
1167
+ {val : int8 (- 128 ), target : "-128" },
1168
+ {val : int16 (- 32768 ), target : "-32768" },
1169
+ {val : int32 (- 2147483648 ), target : "-2147483648" },
1170
+ {val : int64 (- 9223372036854775808 ), target : "-9223372036854775808" },
1171
+ {val : uint (128 ), target : "128" },
1172
+ {val : uint8 (255 ), target : "255" },
1173
+ {val : uint16 (65535 ), target : "65535" },
1174
+ {val : uint32 (4294967295 ), target : "4294967295" },
1175
+ {val : uint64 (18446744073709551615 ), target : "18446744073709551615" },
1176
+ }
1177
+ for _ , c := range cases {
1178
+ cell := & xlsxC {}
1179
+ setCellIntFunc (cell , c .val )
1180
+ assert .Equal (t , c .target , cell .V )
1181
+ }
1182
+ }
1183
+
1156
1184
func TestSIString (t * testing.T ) {
1157
1185
assert .Empty (t , xlsxSI {}.String ())
1158
1186
}
0 commit comments