Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test for the recent glew accessor functionality
- Loading branch information
1 parent
907ae2c
commit 5c0b679
Showing
1 changed file
with
42 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,42 @@ | ||
#! /usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use OpenGL::Modern ':all'; | ||
use OpenGL::Modern::Helpers 'glGetVersion_p'; | ||
|
||
SKIP: { | ||
skip "glewContext did not succeed, skipping live tests", 1 | ||
unless glewCreateContext() == GLEW_OK; # returns GL_TRUE or GL_FALSE | ||
|
||
my $gI_status = ( done_glewInit() ) ? GLEW_OK() : glewInit(); # returns GLEW_OK or ??? | ||
skip "glewInit did not succeed, skipping live tests", 1 unless $gI_status == GLEW_OK; | ||
|
||
my @version_pairs = ( | ||
[ GLEW_VERSION_1_1, 1.1 ], | ||
[ GLEW_VERSION_1_2, 1.2 ], | ||
[ GLEW_VERSION_1_3, 1.3 ], | ||
[ GLEW_VERSION_1_4, 1.4 ], | ||
[ GLEW_VERSION_1_5, 1.5 ], | ||
[ GLEW_VERSION_2_0, 2.0 ], | ||
[ GLEW_VERSION_2_1, 2.1 ], | ||
[ GLEW_VERSION_3_0, 3.0 ], | ||
[ GLEW_VERSION_3_1, 3.1 ], | ||
[ GLEW_VERSION_3_2, 3.2 ], | ||
[ GLEW_VERSION_3_3, 3.3 ], | ||
[ GLEW_VERSION_4_0, 4.0 ], | ||
[ GLEW_VERSION_4_1, 4.1 ], | ||
[ GLEW_VERSION_4_2, 4.2 ], | ||
[ GLEW_VERSION_4_3, 4.3 ], | ||
[ GLEW_VERSION_4_4, 4.4 ], | ||
[ GLEW_VERSION_4_5, 4.5 ], | ||
); | ||
my $version = glGetVersion_p; | ||
$_->[2] = $version >= $_->[1] ? 1 : 0 for @version_pairs; | ||
|
||
is $_->[0], $_->[2], sprintf "glew version %.1f reported correctly as $_->[2] for $version", $_->[1] # | ||
for @version_pairs; | ||
|
||
done_testing; | ||
} |