about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/noto-fonts-cjk-qt-default-weight.nix
blob: 678013cf3ab9031bb322864cdb7f01c1516b83fd (plain) (blame)
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
import ./make-test-python.nix ({ pkgs, lib, ... }: {
  name = "noto-fonts-cjk-qt";
  meta.maintainers = with lib.maintainers; [ oxalica ];

  nodes.machine = {
    imports = [ ./common/x11.nix ];
    fonts = {
      enableDefaultFonts = 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}")
    '';
})