@@ -72,4 +72,42 @@ test_that("wb_set_base_font() actually alters the base font", {
72
72
fS <- xml_node(wb $ theme , " a:theme" , " a:themeElements" , " a:fontScheme" )
73
73
expect_equal(character (), fS )
74
74
75
+ # custom panose values are possible
76
+ wb <- wb_workbook(theme = thm )$
77
+ set_base_font(font_name = " Monaco" , font_panose = " xxxxxxxxxxxxxx" )
78
+ fS <- xml_node(wb $ theme , " a:theme" , " a:themeElements" , " a:fontScheme" )
79
+
80
+ exp <- " <a:latin typeface=\" Monaco\" panose=\" xxxxxxxxxxxxxx\" />"
81
+ got <- xml_node(fS , " a:fontScheme" , " a:majorFont" , " a:latin" )
82
+ expect_equal(exp , got )
83
+ got <- xml_node(fS , " a:fontScheme" , " a:minorFont" , " a:latin" )
84
+ expect_equal(exp , got )
85
+
86
+ # different font types are possible for panose, not sure how useful this is
87
+ wb <- wb_workbook()$
88
+ set_base_font(font_name = " Arial" , font_type = " Italic" )
89
+ fS <- xml_node(wb $ theme , " a:theme" , " a:themeElements" , " a:fontScheme" )
90
+
91
+ exp <- " <a:latin typeface=\" Arial\" panose=\" 020B0604020202090204\" />"
92
+ got <- xml_node(fS , " a:fontScheme" , " a:majorFont" , " a:latin" )
93
+ expect_equal(exp , got )
94
+ got <- xml_node(fS , " a:fontScheme" , " a:minorFont" , " a:latin" )
95
+ expect_equal(exp , got )
96
+
97
+ })
98
+
99
+ test_that(" hyperlink font size works" , {
100
+
101
+ wb <- wb_workbook()$
102
+ set_base_font(font_size = 13 , font_name = " Monaco" )$
103
+ add_worksheet()$
104
+ add_formula(x = create_hyperlink(text = " foo" , file = " bar" ))
105
+
106
+ exp <- c(
107
+ " <font><color theme=\" 1\" /><family val=\" 2\" /><name val=\" Monaco\" /><scheme val=\" minor\" /><sz val=\" 13\" /></font>" ,
108
+ " <font><color theme=\" 10\" /><name val=\" Monaco\" /><sz val=\" 13\" /><u val=\" single\" /></font>"
109
+ )
110
+ got <- wb $ styles_mgr $ styles $ fonts
111
+ expect_equal(exp , got )
112
+
75
113
})
0 commit comments