File: shaders.py

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (31 lines) | stat: -rw-r--r-- 924 bytes parent folder | download
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
import os
import pymol
from pymol import cmd, testing, stored

@testing.requires("no_run_all", "gui")
class StressShaders(testing.PyMOLTestCase):

    def _setup_movie(self, rep):
        cmd.load(self.datafile('1aon.pdb.gz'))
        cmd.show_as(rep)
        cmd.orient()
        cmd.mset('1x100')
        pymol.movie.roll(1, cmd.count_frames(), 0, 'y')

    @testing.foreach(
            (0, 0),
            (0, 0, "surface"),
            (1, 0),
            (1, 0, "surface"),
            (1, 1),
            )
    def test(self, use_shaders, cgo_shader_ub, rep="cartoon"):
        self._setup_movie(rep)

        cmd.set("use_shaders", use_shaders)
        cmd.set("cgo_shader_ub_color", cgo_shader_ub)
        cmd.set("cgo_shader_ub_flags", cgo_shader_ub)
        cmd.set("cgo_shader_ub_normal", cgo_shader_ub)

        with testing.mkdtemp() as tempdir, self.timing():
            cmd.mpng(os.path.join(tempdir, "f"))