Exemple #1
0
import os
import sys
import time

import numpy as np
import pytest

import vtki
from vtki import QtInteractor
from vtki.plotting import system_supports_plotting

NO_PLOTTING = not system_supports_plotting()


# dummy class to allow module init
class QMainWindow(object):
    pass


try:
    import PyQt5
    from PyQt5.Qt import (QMainWindow, QFrame, QVBoxLayout, QAction)
    has_pyqt5 = True
except:
    has_pyqt5 = False

    class QMainWindow(object):
        pass


class MainWindow(QMainWindow):
Exemple #2
0
except:
    test_path = '/home/alex/afrl/python/source/vtki/tests'


def test_volume():
    assert beam.volume > 0.0


def test_merge():
    beamA = vtki.UnstructuredGrid(examples.hexbeamfile)
    beamB = beamA.copy()
    beamB.points[:, 1] += 1
    beamA.Merge(beamB)


@pytest.mark.skipif(not system_supports_plotting(),
                    reason="Requires system to support plotting")
def test_struct_example():
    # create and plot structured grid
    grid = examples.load_structured()
    cpos = grid.plot(off_screen=True)  # basic plot
    assert isinstance(cpos, list)

    # Plot mean curvature
    cpos_curv = grid.plot_curvature(off_screen=True)
    assert isinstance(cpos_curv, list)


def test_init_from_structured():
    unstruct_grid = vtki.UnstructuredGrid(sgrid)
    assert unstruct_grid.points.shape[0] == x.size
Exemple #3
0
import sys

import pytest


import vtki
from vtki.plotting import system_supports_plotting

if __name__ != '__main__':
    OFF_SCREEN = 'pytest' in sys.modules
else:
    OFF_SCREEN = False


@pytest.mark.skipif(not system_supports_plotting(), reason="Requires system to support plotting")
def test_camera_position():
    plotter = vtki.Plotter(off_screen=OFF_SCREEN)
    plotter.add_mesh(vtki.Sphere())
    plotter.show()
    assert isinstance(plotter.camera_position, list)