The font tests
- Shell 100%
| .fmf | ||
| tests | ||
| README.rst | ||
Fonts Tests
===========
Common test repository for Fedora fonts packages.
Use `tmt` to run tests easily:
tmt run
How to create
-------------
1. `tmt init` at a package repository
2. `tmt plan create -t mini /plans/<sub package name>`
3. Replace `plans/<sub package name>.fmf` with the following template
or
1. `dnf install fontrpmspec`
2. `fontrpmspec-gentmt <path to package repository>`
3. Review generated fmf plan files under `<path to package repository>/plans`
Template
--------
::
summary: Fonts related tests
discover:
how: fmf
url: https://src.fedoraproject.org/tests/fonts
execute:
how: tmt
environment:
PACKAGE: <package name to test>
FONT_ALIAS: <generic alias to test such as sans-serif, serif, monospace>
FONT_FAMILY: <family name for this font>
FONT_LANG: <comma-separated list of language identifier>
FONT_WIDTH: <width name to test>
Available test cases
--------------------
- Default fonts
A test case to check if the targeted font package affects various default
generic alias selection.
The following parameters are used in this test:
- DEFAULT_SANS (optional)
default value is 0. set 1 if the targeted font package is supposed to
be a default font for sans-serif on a certain language.
- DEFAULT_SERIF (optional)
default value is 0. set 1 if the targeted font package is supposed to
be a default font for serif on a certain language.
- DEFAULT_MONO (optional)
default value is 0. set 1 if the targeted font package is supposed to
be a default font for monospace on a certain language.
- DEFAULT_EMOJI (optional)
default value is 0. set 1 if the targeted font package is supposed to
be a default font for emoji.
- DEFAULT_MATH (optional)
default value is 0. set 1 if the targeted font package is supposed to
be a default font for math.
- FONT_FAMILY
- FONT_LANG (optional)
default value is en. en will be used for und-zsye (emoji) and und-zmth (math).
- Generic alias
A test case to check if the expected generic alias is properly assigned.
The following parameters are used in this test:
- PACKAGE
- FONT_ALIAS (optional)
default value is sans-serif
- FONT_FAMILY
- FONT_LANG (optional)
default value is en.
- FONT_WIDTH (optional)
default value is normal.
- Language coverage
A test case to check if a font in PACKAGE has sufficient coverage for FONT_LANG.
The following parameters are used in this test:
- PACKAGE
- FONT_LANG (optional)
- FONT_LANG_EXCLUDE_FILES (optional)
Set a regex to skip some bogus font files.
- Validate family name
A test case to check if a given FONT_FAMILY is really valid for this package.
This is to prevent some human error.
The following parameters are used in this test:
- PACKAGE
- FONT_FAMILY
- FONT_VALIDATE_EXCLUDE_FILES (optional)
Set a regexp to skip some bogus fonts.
FAQ
---
- My font package doesn't have an own config.
You can add `generic_alias` into `exclude` at `discover` section like::
discover:
how: fmf
url: https://src.fedoraproject.org/tests/fonts
exclude:
- generic_alias
- My font package doesn't have particular language coverage.
You can add `lang_coverage` and `default_fonts` into `exclude` at `discover` section like::
discover:
how: fmf
url: https://src.fedoraproject.org/tests/fonts
exclude:
- lang_coverage
- default_fonts
- Unable to run `tmt run` locally.
You may want to add the following snippet into your fmf plan file.
Please note that a package set to `package:` will be pulled from
the official repo. it may not contains any changes you may made in
your repo::
prepare:
name: tmt
how: install
package: <package name to test>
or `fontrpmspec-gentmt -a` if you use fontrpmspec to generate.
- How to deal with TrueType/OpenType Collection format?
This test sets are basically supposed to have one plan per sub-packages.
However, for some limitation in the implementation, it can't be done for
TTC/OTC. So you may want to have separate plan file per faces in TTC/OTC.
See `adobe-source-han-mono-fonts package <https://src.fedoraproject.org/rpms/adobe-source-han-mono-fonts/blob/rawhide/f/plans>`_ for example.
- I saw "No space left on device" error during testing.
- Too many sub packages. How can this be simplified?
You can put required variables into a file on plans directory like the following format::
# comment
PACKAGE;FONT_ALIAS;FONT_LANG;FONT_WIDTH;FONT_FAMILY;DEFAULT_SANS;DEFAULT_SERIF;DEFAULT_MONO;DEFAULT_EMOJI;DEFAULT_MATH;FONT_LANG_EXCLUDE_FILES;FONT_VALIDATE_EXCLUDE_FILES;
...
And then set a filename to VARLIST like::
environment:
- VARLIST: <srpm-name>.list