Navigation Menu

Skip to content

Commit

Permalink
Added unit tests for all ImageMapTexture wrap modes (issue #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dade916 committed Jan 3, 2018
1 parent 247ee3d commit 54b894a
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 0 deletions.
72 changes: 72 additions & 0 deletions pyunittests/pyluxcoreunittests/tests/textures/testwrap.py
@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
################################################################################
# Copyright 1998-2018 by authors (see AUTHORS.txt)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

import unittest
import pyluxcore

from pyluxcoreunittests.tests.utils import *
from pyluxcoreunittests.tests.imagetest import *

################################################################################
# ImageMapTexture wrap repeat test
################################################################################

def TestWrapRepeat(cls, params):
StandardSceneTest(cls, params, "simple/tex-wrap-repeat.cfg", "WrapRepeat")

class WrapRepeat(ImageTest):
pass

WrapRepeat = AddTests(WrapRepeat, TestWrapRepeat, GetTestCases())

################################################################################
# ImageMapTexture wrap black test
################################################################################

def TestWrapBlack(cls, params):
StandardSceneTest(cls, params, "simple/tex-wrap-black.cfg", "WrapBlack")

class WrapBlack(ImageTest):
pass

WrapBlack = AddTests(WrapBlack, TestWrapBlack, GetTestCases())

################################################################################
# ImageMapTexture wrap white test
################################################################################

def TestWrapWhite(cls, params):
StandardSceneTest(cls, params, "simple/tex-wrap-white.cfg", "WrapWhite")

class WrapWhite(ImageTest):
pass

WrapWhite = AddTests(WrapWhite, TestWrapWhite, GetTestCases())


################################################################################
# ImageMapTexture wrap clamp test
################################################################################

def TestWrapClamp(cls, params):
StandardSceneTest(cls, params, "simple/tex-wrap-black.cfg", "WrapClamp")

class WrapClamp(ImageTest):
pass

WrapClamp = AddTests(WrapClamp, TestWrapClamp, GetTestCases())

18 changes: 18 additions & 0 deletions pyunittests/resources/scenes/simple/room-nowall.ply
@@ -0,0 +1,18 @@
ply
format ascii 1.0
comment Created by Blender3D 249 - www.blender.org, source file:
element vertex 4
property float x
property float y
property float z
property float s
property float t
element face 2
property list uchar uint vertex_indices
end_header
3.775332 3.845772 0.003744 2 -1
3.775332 -3.674710 0.003744 2 2
-3.755317 -3.674709 0.003744 -1 2
-3.755316 3.845773 0.003744 -1 -1
3 0 1 2
3 0 2 3
4 changes: 4 additions & 0 deletions pyunittests/resources/scenes/simple/tex-wrap-black.cfg
@@ -0,0 +1,4 @@
film.width = 512
film.height = 384
scene.file = resources/scenes/simple/tex-wrap-black.scn

19 changes: 19 additions & 0 deletions pyunittests/resources/scenes/simple/tex-wrap-black.scn
@@ -0,0 +1,19 @@
scene.camera.lookat.orig = 0 -1 10
scene.camera.lookat.target = 0.0 0.0 0.0
################################################################################
scene.textures.imagetex.type = imagemap
scene.textures.imagetex.file = resources/img/grid.png
scene.textures.imagetex.wrap = black
################################################################################
scene.materials.whitematte.type = matte
scene.materials.whitematte.kd = imagetex
################################################################################
scene.shapes.room.type = mesh
scene.shapes.room.ply = resources/scenes/simple/room-nowall.ply
################################################################################
scene.objects.room.material = whitematte
scene.objects.room.shape = room
################################################################################
scene.lights.l1.type = infinite
scene.lights.l1.file = resources/hdr/arch.exr
scene.lights.l1.gain = 4.0 4.0 4.0
4 changes: 4 additions & 0 deletions pyunittests/resources/scenes/simple/tex-wrap-clamp.cfg
@@ -0,0 +1,4 @@
film.width = 512
film.height = 384
scene.file = resources/scenes/simple/tex-wrap-clamp.scn

19 changes: 19 additions & 0 deletions pyunittests/resources/scenes/simple/tex-wrap-clamp.scn
@@ -0,0 +1,19 @@
scene.camera.lookat.orig = 0 -1 10
scene.camera.lookat.target = 0.0 0.0 0.0
################################################################################
scene.textures.imagetex.type = imagemap
scene.textures.imagetex.file = resources/img/grid.png
scene.textures.imagetex.wrap = clamp
################################################################################
scene.materials.whitematte.type = matte
scene.materials.whitematte.kd = imagetex
################################################################################
scene.shapes.room.type = mesh
scene.shapes.room.ply = resources/scenes/simple/room-nowall.ply
################################################################################
scene.objects.room.material = whitematte
scene.objects.room.shape = room
################################################################################
scene.lights.l1.type = infinite
scene.lights.l1.file = resources/hdr/arch.exr
scene.lights.l1.gain = 4.0 4.0 4.0
4 changes: 4 additions & 0 deletions pyunittests/resources/scenes/simple/tex-wrap-repeat.cfg
@@ -0,0 +1,4 @@
film.width = 512
film.height = 384
scene.file = resources/scenes/simple/tex-wrap-repeat.scn

19 changes: 19 additions & 0 deletions pyunittests/resources/scenes/simple/tex-wrap-repeat.scn
@@ -0,0 +1,19 @@
scene.camera.lookat.orig = 0 -1 10
scene.camera.lookat.target = 0.0 0.0 0.0
################################################################################
scene.textures.imagetex.type = imagemap
scene.textures.imagetex.file = resources/img/grid.png
scene.textures.imagetex.wrap = repeat
################################################################################
scene.materials.whitematte.type = matte
scene.materials.whitematte.kd = imagetex
################################################################################
scene.shapes.room.type = mesh
scene.shapes.room.ply = resources/scenes/simple/room-nowall.ply
################################################################################
scene.objects.room.material = whitematte
scene.objects.room.shape = room
################################################################################
scene.lights.l1.type = infinite
scene.lights.l1.file = resources/hdr/arch.exr
scene.lights.l1.gain = 4.0 4.0 4.0
4 changes: 4 additions & 0 deletions pyunittests/resources/scenes/simple/tex-wrap-white.cfg
@@ -0,0 +1,4 @@
film.width = 512
film.height = 384
scene.file = resources/scenes/simple/tex-wrap-white.scn

19 changes: 19 additions & 0 deletions pyunittests/resources/scenes/simple/tex-wrap-white.scn
@@ -0,0 +1,19 @@
scene.camera.lookat.orig = 0 -1 10
scene.camera.lookat.target = 0.0 0.0 0.0
################################################################################
scene.textures.imagetex.type = imagemap
scene.textures.imagetex.file = resources/img/grid.png
scene.textures.imagetex.wrap = white
################################################################################
scene.materials.whitematte.type = matte
scene.materials.whitematte.kd = imagetex
################################################################################
scene.shapes.room.type = mesh
scene.shapes.room.ply = resources/scenes/simple/room-nowall.ply
################################################################################
scene.objects.room.material = whitematte
scene.objects.room.shape = room
################################################################################
scene.lights.l1.type = infinite
scene.lights.l1.file = resources/hdr/arch.exr
scene.lights.l1.gain = 4.0 4.0 4.0

0 comments on commit 54b894a

Please sign in to comment.