From 51cdfcf732337a8b66eb7c1911e9bc10a5a3d826 Mon Sep 17 00:00:00 2001 From: Lukas Eipert Date: Wed, 7 Dec 2022 11:42:00 +0100 Subject: [PATCH] feat: Proper Emoji support in Chrome images We often have flaky tests around emoji rendering. Maybe we can improve the test quality by adding a proper emoji font. The existing install-noto-image script wasn't utilized and could be simplified anyhow. Furthermore I think it is fine to install the font when Chrome is installed, given that we use the Chrome images for integration tests with the browser. --- scripts/install-chrome | 21 +++++++++++++++ scripts/install-noto-emoji | 52 -------------------------------------- 2 files changed, 21 insertions(+), 52 deletions(-) delete mode 100755 scripts/install-noto-emoji diff --git a/scripts/install-chrome b/scripts/install-chrome index 386cff0..12d4b37 100755 --- a/scripts/install-chrome +++ b/scripts/install-chrome @@ -3,6 +3,14 @@ set -xeuo pipefail IFS=$'\n\t' +function download_noto() { + local NOTO_VERSION + # https://github.com/googlefonts/noto-emoji/releases/tag/v2.038 + NOTO_VERSION="v2.038" + curl --silent -O --location --fail "https://github.com/googlefonts/noto-emoji/raw/${NOTO_VERSION}/fonts/NotoColorEmoji.ttf" + echo "NotoColorEmoji.ttf" +} + function download_deb() { component=$1 @@ -44,6 +52,19 @@ function build_debian() { rm -f "$DRIVER_DEB" fi + # We have loads of tests rendering emoji, so let's ensure a proper emoji font is installed + echo "Installing Noto emoji font" + FONT_FILE=$(download_noto) + + mkdir -p /usr/local/share/fonts + mv "$FONT_FILE" /usr/local/share/fonts/ + chmod 644 "/usr/local/share/fonts/${FONT_FILE}" + ls -la /usr/local/share/fonts/ + + fc-cache -fv + fc-match -s noto + + # Cleanup apt-get autoremove -yq apt-get clean -yqq rm -rf /var/lib/apt/lists/* diff --git a/scripts/install-noto-emoji b/scripts/install-noto-emoji deleted file mode 100755 index d7c6f4f..0000000 --- a/scripts/install-noto-emoji +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# This script installs noto color emoji - -function build_debian() { - apt-get update - apt-get install unzip - - cat > ~/.fonts.conf << EOM - - - - - - Noto Color Emoji - - true - - - - chrome - - - Noto Color Emoji - - - -EOM - - mkdir setup_fonts - cd setup_fonts - curl https://noto-website-2.storage.googleapis.com/pkgs/NotoColorEmoji-unhinted.zip -LO - unzip NotoColorEmoji-unhinted.zip - - mkdir -p /usr/local/share/fonts - cp NotoColorEmoji.ttf /usr/local/share/fonts/ - ls -la /usr/local/share/fonts/ - chmod 644 /usr/local/share/fonts/NotoColorEmoji.ttf - - fc-cache -fv - - cd .. - rm -r setup_fonts - apt-get clean -yqq && rm -rf /var/lib/apt/lists/* -} - -BUILD_OS=${BUILD_OS:-debian} - -if [[ $BUILD_OS =~ debian ]]; then - build_debian "$@" -elif [[ $BUILD_OS =~ ubi ]]; then - build_ubi "$@" -fi