From 6d5ce4966371588758c306e12b2960ca3b99156d Mon Sep 17 00:00:00 2001 From: Mikael Grankvist Date: Wed, 18 Nov 2020 14:29:34 +0200 Subject: [PATCH] test: add test for setting global font Fixes #9409 --- .../app-theme/font/ostrich-sans-regular.ttf | Bin 0 -> 18044 bytes .../frontend/theme/app-theme/global.css | 6 ++++++ .../vaadin/flow/uitest/ui/theme/ThemeView.java | 8 ++++++-- .../vaadin/flow/uitest/ui/theme/ThemeIT.java | 6 +++++- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 flow-tests/test-themes/frontend/theme/app-theme/font/ostrich-sans-regular.ttf diff --git a/flow-tests/test-themes/frontend/theme/app-theme/font/ostrich-sans-regular.ttf b/flow-tests/test-themes/frontend/theme/app-theme/font/ostrich-sans-regular.ttf new file mode 100644 index 0000000000000000000000000000000000000000..58545d6f80ad8a29b98b27c1915c2e2399d3cbb2 GIT binary patch literal 18044 zcmeHvdvsgXneX1`p_gU(NR}+yvaBP^wxY@p){mW8Vr|}MH$Luvd&Rl%B5X2^iE&Xb{I+{G3E1xZ50VfOy~?pt>h zEyn%=<*kGWTW;OBcQ@)4Lgc?gYPog$!TIXJ_8OG`o{+X5ZQZhQ?%laZ|Cx~PGiYz! zii(0xIfC*pQLf&)W8a?zr?@y^|Jf&QM549Y~^ zxpBvqaLWxDl&jJH_q%uP-Pil^FW*JT4IiNV)!nym*P(SWd|abQCaB@ntg4ngt?b&Pdqv zd=#YoZ}-95_mVVGFA@{Up+=r3V@UWj@|-+}yvj>h2euZZ!e}E4D6yw1(C4Rks-VVB zK1rS+Um|B!o9b4}RKHrK)~Yde!$orWGM-X->tCrvRn$_o;@Z~BzqtI3%g2*<`j@Z3Xs1N0H)m6}vqp-qNyi zUxmLipa!c#)it%@6_J(Ey84D#V^ciQ+|rtCYwze>)zzI!_hfDWHLe~Q99lEHcI3v< zKN-7e{N{;|O|F}|WqSS0hS`lD9`B<{pCDw*=8tO3*B{!%GyC@6dGNp;|Bq)s+$_kO zog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R6df874V!c5_x z7A_S2+)?UCJDzm>kD_?dfuf5_TKSIhuCv?u8JEj7?E0kZ41V9|zyDQiDc)Xu!JT&h zsry;?uRK$p&v_O-@0B!`OqP7D3_siv< z4@CG8zY1TQZ``-r_vgMdzVG|qt*FLtn*VO&+;EsYW_(8ouA#U}fFFWyaE(6;Vc!u` z$%-Q50wYiHzai|*=Rw!x)A>9*GyPybFX0r%6ZyPM%0chOyCzaiF6Q&!Av>vr-Su5K zU44+;PPUO-v1hoCs5lq18T6=D6BL^3oQvmp^|1_c=UyBg*^uQ=2iCN^ZhA`JJd+%iFh+{bUEZ1NlvWd>2~w zedHVJhu)dsqwK|;*jp;*+<>{W--kzB9QyNZ|_2V!?Jw5d@Dx#V}FNH$!I~u7k4uD z^30H_h>}7J*l_~Zfv?OJe6{4lNd-4{-b-*ApcK-u93)r)$ySN)uvF|_SK)+THNN$$ z#p%8kSk09<6<3FE*&0ZUuWB5piJP$()QU63Z8%5XfgR&jq>FUpe^N+eJu{$;Ug({E zz%W1t$q;yb7+4ztMn|#RKL%*W$;~)v_c3UxbvQwI3z;VC$qd;*X30iufZj(%a-2#O z=Q*hv`&3r!jTKNkEyNM>BC1d)blN#cp|6ld@?~-l`Ah1e#nf%yzjIq-V^3o~?PY1a zv5}XNHs#Cle45Co&H1z?pSI@HWIk=nr|tQ)$4Hy<{Wdk(=C|Ft|Mo3&8~1KCn&SON z+QQR5Oo2Q{FCW#QWY%bw(Mg@s&#cq?+5ZWlDfka1++)amYMmedfy4A9(L}XR6QjMF zr1m{eM7o~{*lj~uR{OG2EMG98Ap7zKGYY2Ce8GZ(*_$s|QLtEz0zTNu_guhwwjI8V eo^`SR0Q$D$xdJ?wFBYO`H!m00;Tv3#*8c^W(8JIG literal 0 HcmV?d00001 diff --git a/flow-tests/test-themes/frontend/theme/app-theme/global.css b/flow-tests/test-themes/frontend/theme/app-theme/global.css index 1506922ca9a..8e281c6c94d 100644 --- a/flow-tests/test-themes/frontend/theme/app-theme/global.css +++ b/flow-tests/test-themes/frontend/theme/app-theme/global.css @@ -1,3 +1,9 @@ +@font-face { + font-family: "Ostrich"; + src: url("theme/app-theme/font/ostrich-sans-regular.ttf") format("TrueType"); +} + body { background-image: url('theme/app-theme/img/bg.jpg'); + font-family: "Ostrich"; } diff --git a/flow-tests/test-themes/src/main/java/com/vaadin/flow/uitest/ui/theme/ThemeView.java b/flow-tests/test-themes/src/main/java/com/vaadin/flow/uitest/ui/theme/ThemeView.java index b95938ad6f2..a7d4daf4593 100644 --- a/flow-tests/test-themes/src/main/java/com/vaadin/flow/uitest/ui/theme/ThemeView.java +++ b/flow-tests/test-themes/src/main/java/com/vaadin/flow/uitest/ui/theme/ThemeView.java @@ -20,10 +20,14 @@ import com.vaadin.flow.component.html.Span; import com.vaadin.flow.router.Route; -@Route("com.vaadin.flow.uitest.ui.theme.Theme") +@Route("com.vaadin.flow.uitest.ui.theme.ThemeView") public class ThemeView extends Div { + public static final String TEST_TEXT_ID = "test-text"; + public ThemeView() { - add(new Span("This is the theme test view")); + final Span textSpan = new Span("This is the theme test view"); + textSpan.setId(TEST_TEXT_ID); + add(textSpan); } } diff --git a/flow-tests/test-themes/src/test/java/com/vaadin/flow/uitest/ui/theme/ThemeIT.java b/flow-tests/test-themes/src/test/java/com/vaadin/flow/uitest/ui/theme/ThemeIT.java index 5e9055a83c0..e8753f53e63 100644 --- a/flow-tests/test-themes/src/test/java/com/vaadin/flow/uitest/ui/theme/ThemeIT.java +++ b/flow-tests/test-themes/src/test/java/com/vaadin/flow/uitest/ui/theme/ThemeIT.java @@ -18,6 +18,7 @@ import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; import com.vaadin.flow.testutil.ChromeBrowserTest; @@ -40,9 +41,12 @@ public void applicationTheme_GlobalCss_isUsed() { // No exception for bg-image should exist checkLogsForErrors(); + final WebElement body = findElement(By.tagName("body")); Assert.assertEquals( "url(\"" + getRootURL() + "/theme/app-theme/img/bg.jpg\")", - findElement(By.tagName("body")).getCssValue("background-image")); + body.getCssValue("background-image")); + + Assert.assertEquals("Ostrich", body.getCssValue("font-family")); getDriver().get(getRootURL() + "/theme/app-theme/img/bg.jpg"); Assert.assertFalse("app-theme background file should be served",