summaryrefslogtreecommitdiffstats
path: root/nixos/tests/noto-fonts-cjk-qt-default-weight.nix
blob: 636dfa3cfb729aeb665817d45418397d8fc1a9bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ pkgs, lib, ... }:
{
  name = "noto-fonts-cjk-qt";
  meta.maintainers = with lib.maintainers; [ oxalica ];

  nodes.machine = {
    imports = [ ./common/x11.nix ];
    fonts = {
      enableDefaultPackages = false;
      fonts = [ pkgs.noto-fonts-cjk-sans ];
    };
  };

  testScript =
    let
      script =
        pkgs.writers.writePython3 "qt-default-weight"
          {
            libraries = [ pkgs.python3Packages.pyqt6 ];
          }
          ''
            from PyQt6.QtWidgets import QApplication
            from PyQt6.QtGui import QFont, QRawFont

            app = QApplication([])
            f = QRawFont.fromFont(QFont("Noto Sans CJK SC", 20))

            assert f.styleName() == "Regular", f.styleName()
          '';
    in
    ''
      machine.wait_for_x()
      machine.succeed("${script}")
    '';
}