Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ca0e67
commit 42b7d98
Showing
7 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "TestHarness.hpp" | ||
|
||
#include <gtest/gtest.h> | ||
|
||
TEST(Regression, draw_3d_shapes_test) { | ||
if (!TestHarness::windowing_supported()) return; | ||
auto test_harness = LAUNCH_HARNESS_FOR_GAME(TestConfig(), "gmx"); | ||
if (!test_harness) FAIL() << "Game could not be run."; | ||
|
||
test_harness->wait(); // Let the game render a frame first. | ||
ASSERT_TRUE(test_harness->game_is_running()) | ||
<< "Game stopped running unexpectedly"; | ||
|
||
test_harness->screen_save("./test-harness-out/enigma_draw_3d_shapes_test.png"); | ||
|
||
test_harness->close_window(); | ||
bool game_running = test_harness->game_is_running(); | ||
for (int i = 0; game_running && i < 10; ++i) { | ||
test_harness->wait(); | ||
game_running = test_harness->game_is_running(); | ||
} | ||
ASSERT_FALSE(game_running) << "Game did not exit after window was closed!"; | ||
} |
16 changes: 16 additions & 0 deletions
16
CommandLine/testing/Tests/draw_3d_shapes_test.gmx/background/bkg_test.background.gmx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<background> | ||
<istileset>0</istileset> | ||
<tilewidth>16</tilewidth> | ||
<tileheight>16</tileheight> | ||
<tilexoff>0</tilexoff> | ||
<tileyoff>0</tileyoff> | ||
<tilehsep>0</tilehsep> | ||
<tilevsep>0</tilevsep> | ||
<HTile>0</HTile> | ||
<VTile>0</VTile> | ||
<For3D>0</For3D> | ||
<width>64</width> | ||
<height>64</height> | ||
<data>images\bkg_test.png</data> | ||
</background> |
Binary file added
BIN
+8.31 KB
CommandLine/testing/Tests/draw_3d_shapes_test.gmx/background/images/bkg_test.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions
24
CommandLine/testing/Tests/draw_3d_shapes_test.gmx/draw_3d_shapes_test.project.gmx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<assets> | ||
<Configs name="configs"/> | ||
<sprites name="sprites"/> | ||
<sounds name="sound"/> | ||
<backgrounds name="background"> | ||
<background>background\bkg_test</background> | ||
</backgrounds> | ||
<paths name="paths"/> | ||
<scripts name="scripts"> | ||
<script>scripts\d3d_draw_shape.gml</script> | ||
</scripts> | ||
<shaders name="shaders"/> | ||
<fonts name="fonts"/> | ||
<timelines name="timelines"/> | ||
<objects name="objects"> | ||
<object>objects\obj_0</object> | ||
</objects> | ||
<rooms name="rooms"> | ||
<room>rooms\rm_0</room> | ||
</rooms> | ||
<constants number="0"/> | ||
<help/> | ||
</assets> |
89 changes: 89 additions & 0 deletions
89
CommandLine/testing/Tests/draw_3d_shapes_test.gmx/objects/obj_0.object.gmx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<object> | ||
<spriteName><undefined></spriteName> | ||
<solid>0</solid> | ||
<visible>-1</visible> | ||
<depth>0</depth> | ||
<persistent>0</persistent> | ||
<maskName><undefined></maskName> | ||
<parentName><undefined></parentName> | ||
<events> | ||
<event enumb="0" eventtype="0"> | ||
<action> | ||
<libid>1</libid> | ||
<id>603</id> | ||
<kind>7</kind> | ||
<userelative>0</userelative> | ||
<useapplyto>-1</useapplyto> | ||
<isquestion>0</isquestion> | ||
<exetype>2</exetype> | ||
<functionname/> | ||
<codestring/> | ||
<whoName>self</whoName> | ||
<relative>0</relative> | ||
<isnot>0</isnot> | ||
<arguments> | ||
<argument> | ||
<kind>1</kind> | ||
<string>test_texture = background_get_texture(bkg_test); | ||
d3d_start(); | ||
d3d_set_hidden(true); | ||
d3d_set_culling(false); | ||
size = 20;</string> | ||
</argument> | ||
</arguments> | ||
</action> | ||
</event> | ||
<event enumb="0" eventtype="8"> | ||
<action> | ||
<libid>1</libid> | ||
<id>603</id> | ||
<kind>7</kind> | ||
<userelative>0</userelative> | ||
<useapplyto>-1</useapplyto> | ||
<isquestion>0</isquestion> | ||
<exetype>2</exetype> | ||
<functionname/> | ||
<codestring/> | ||
<whoName>self</whoName> | ||
<relative>0</relative> | ||
<isnot>0</isnot> | ||
<arguments> | ||
<argument> | ||
<kind>1</kind> | ||
<string>d3d_set_projection_ortho(0, 0, room_width, room_height, 0); | ||
| ||
for (var y = 0; y < 6; y += 1) { | ||
var yy = 25 + y * 45; | ||
| ||
for (var i = 0; i < 4; i += 1) { | ||
// Show all sides around the x-axis | ||
d3d_transform_set_rotation_x(i * 90); | ||
d3d_transform_add_translation(25 + i * 45, yy, 0); | ||
d3d_draw_shape(y, size, test_texture); | ||
// Show all sides around the y-axis | ||
d3d_transform_set_rotation_y(i * 90); | ||
d3d_transform_add_translation(30 + (i + 4) * 45, yy, 0); | ||
d3d_draw_shape(y, size, test_texture); | ||
} | ||
} | ||
| ||
d3d_transform_set_identity();</string> | ||
</argument> | ||
</arguments> | ||
</action> | ||
</event> | ||
</events> | ||
<PhysicsObject>0</PhysicsObject> | ||
<PhysicsObjectSensor>0</PhysicsObjectSensor> | ||
<PhysicsObjectShape>0</PhysicsObjectShape> | ||
<PhysicsObjectDensity>0.5</PhysicsObjectDensity> | ||
<PhysicsObjectRestitution>0.1</PhysicsObjectRestitution> | ||
<PhysicsObjectGroup>0</PhysicsObjectGroup> | ||
<PhysicsObjectLinearDamping>0.1</PhysicsObjectLinearDamping> | ||
<PhysicsObjectAngularDamping>0.1</PhysicsObjectAngularDamping> | ||
<PhysicsObjectFriction>0.2</PhysicsObjectFriction> | ||
<PhysicsObjectAwake>-1</PhysicsObjectAwake> | ||
<PhysicsObjectKinematic>0</PhysicsObjectKinematic> | ||
<PhysicsShapePoints/> | ||
</object> |
64 changes: 64 additions & 0 deletions
64
CommandLine/testing/Tests/draw_3d_shapes_test.gmx/rooms/rm_0.room.gmx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<room> | ||
<caption/> | ||
<width>640</width> | ||
<height>480</height> | ||
<hsnap>16</hsnap> | ||
<vsnap>16</vsnap> | ||
<isometric>0</isometric> | ||
<speed>30</speed> | ||
<persistent>0</persistent> | ||
<colour>16764006</colour> | ||
<showcolour>-1</showcolour> | ||
<code/> | ||
<enableViews>0</enableViews> | ||
<clearViewBackground>-1</clearViewBackground> | ||
<makerSettings> | ||
<isSet>-1</isSet> | ||
<w>1024</w> | ||
<h>640</h> | ||
<showGrid>-1</showGrid> | ||
<showObjects>-1</showObjects> | ||
<showTiles>-1</showTiles> | ||
<showBackgrounds>-1</showBackgrounds> | ||
<showForegrounds>-1</showForegrounds> | ||
<showViews>0</showViews> | ||
<deleteUnderlyingObj>0</deleteUnderlyingObj> | ||
<deleteUnderlyingTiles>0</deleteUnderlyingTiles> | ||
<page>0</page> | ||
<xoffset>0</xoffset> | ||
<yoffset>0</yoffset> | ||
</makerSettings> | ||
<backgrounds> | ||
<background foreground="0" hspeed="0" htiled="-1" name="" stretch="0" visible="0" vspeed="0" vtiled="-1" x="0" y="0"/> | ||
<background foreground="0" hspeed="0" htiled="-1" name="" stretch="0" visible="0" vspeed="0" vtiled="-1" x="0" y="0"/> | ||
<background foreground="0" hspeed="0" htiled="-1" name="" stretch="0" visible="0" vspeed="0" vtiled="-1" x="0" y="0"/> | ||
<background foreground="0" hspeed="0" htiled="-1" name="" stretch="0" visible="0" vspeed="0" vtiled="-1" x="0" y="0"/> | ||
<background foreground="0" hspeed="0" htiled="-1" name="" stretch="0" visible="0" vspeed="0" vtiled="-1" x="0" y="0"/> | ||
<background foreground="0" hspeed="0" htiled="-1" name="" stretch="0" visible="0" vspeed="0" vtiled="-1" x="0" y="0"/> | ||
<background foreground="0" hspeed="0" htiled="-1" name="" stretch="0" visible="0" vspeed="0" vtiled="-1" x="0" y="0"/> | ||
<background foreground="0" hspeed="0" htiled="-1" name="" stretch="0" visible="0" vspeed="0" vtiled="-1" x="0" y="0"/> | ||
</backgrounds> | ||
<views> | ||
<view hborder="32" hport="480" hspeed="-1" hview="480" objName="<undefined>" vborder="32" visible="0" vspeed="-1" wport="640" wview="640" xport="0" xview="0" yport="0" yview="0"/> | ||
<view hborder="32" hport="480" hspeed="-1" hview="480" objName="<undefined>" vborder="32" visible="0" vspeed="-1" wport="640" wview="640" xport="0" xview="0" yport="0" yview="0"/> | ||
<view hborder="32" hport="480" hspeed="-1" hview="480" objName="<undefined>" vborder="32" visible="0" vspeed="-1" wport="640" wview="640" xport="0" xview="0" yport="0" yview="0"/> | ||
<view hborder="32" hport="480" hspeed="-1" hview="480" objName="<undefined>" vborder="32" visible="0" vspeed="-1" wport="640" wview="640" xport="0" xview="0" yport="0" yview="0"/> | ||
<view hborder="32" hport="480" hspeed="-1" hview="480" objName="<undefined>" vborder="32" visible="0" vspeed="-1" wport="640" wview="640" xport="0" xview="0" yport="0" yview="0"/> | ||
<view hborder="32" hport="480" hspeed="-1" hview="480" objName="<undefined>" vborder="32" visible="0" vspeed="-1" wport="640" wview="640" xport="0" xview="0" yport="0" yview="0"/> | ||
<view hborder="32" hport="480" hspeed="-1" hview="480" objName="<undefined>" vborder="32" visible="0" vspeed="-1" wport="640" wview="640" xport="0" xview="0" yport="0" yview="0"/> | ||
<view hborder="32" hport="480" hspeed="-1" hview="480" objName="<undefined>" vborder="32" visible="0" vspeed="-1" wport="640" wview="640" xport="0" xview="0" yport="0" yview="0"/> | ||
</views> | ||
<instances> | ||
<instance code="" colour="4294967295" id="100001" locked="0" name="inst_5593AEC4" objName="obj_0" rotation="0.0" scaleX="1.0" scaleY="1.0" x="0" y="0"/> | ||
</instances> | ||
<tiles/> | ||
<PhysicsWorld>0</PhysicsWorld> | ||
<PhysicsWorldTop>0</PhysicsWorldTop> | ||
<PhysicsWorldLeft>0</PhysicsWorldLeft> | ||
<PhysicsWorldRight>640</PhysicsWorldRight> | ||
<PhysicsWorldBottom>480</PhysicsWorldBottom> | ||
<PhysicsWorldGravityX>0.0</PhysicsWorldGravityX> | ||
<PhysicsWorldGravityY>10.0</PhysicsWorldGravityY> | ||
<PhysicsWorldPixToMeters>0.1</PhysicsWorldPixToMeters> | ||
</room> |
59 changes: 59 additions & 0 deletions
59
CommandLine/testing/Tests/draw_3d_shapes_test.gmx/scripts/d3d_draw_shape.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// argument0 = shape type | ||
// 0 = d3d_draw_block | ||
// 1 = d3d_draw_cylinder | ||
// 2 = d3d_draw_cone | ||
// 3 = d3d_draw_ellipsoid | ||
// 4 = d3d_draw_wall | ||
// 5 = d3d_draw_floor | ||
// argument1 = size | ||
// argument2 = texture id | ||
var shape = argument0, | ||
size = argument1, | ||
tex = argument2; | ||
|
||
switch (shape) { | ||
case 0: | ||
d3d_draw_block( | ||
-size, -size, -size, | ||
size, size, size, | ||
tex, 1, 1 | ||
); | ||
return 0; | ||
case 1: | ||
d3d_draw_cylinder( | ||
-size, -size, -size, | ||
size, size, size, | ||
tex, 1, 1, | ||
true, 8 | ||
); | ||
return 0; | ||
case 2: | ||
d3d_draw_cone( | ||
-size, -size, -size, | ||
size, size, size, | ||
tex, 1, 1, | ||
true, 8 | ||
); | ||
return 0; | ||
case 3: | ||
d3d_draw_ellipsoid( | ||
-size, -size, -size, | ||
size, size, size, | ||
tex, 1, 1, 8 | ||
); | ||
return 0; | ||
case 4: | ||
d3d_draw_wall( | ||
-size, 0, -size, | ||
size, 0, size, | ||
tex, 1, 1 | ||
); | ||
return 0; | ||
case 5: | ||
d3d_draw_floor( | ||
-size, -size, 0, | ||
size, size, 0, | ||
tex, 1, 1 | ||
); | ||
return 0; | ||
} |