-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not register all drivers on loading the module
Fixes #18 Also updates the tests, and removes some pointer() calls which are no longer neccesary
- Loading branch information
Showing
2 changed files
with
15 additions
and
11 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
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 |
---|---|---|
@@ -1,22 +1,28 @@ | ||
using GDAL | ||
using Base.Test | ||
|
||
info(bytestring(GDAL.C.GDALVersionInfo(pointer("--version")))) | ||
info(bytestring(GDAL.C.GDALVersionInfo("--version"))) | ||
|
||
# drivers | ||
info(GDAL.C.GDALGetDriverCount(), " GDAL drivers found") | ||
info(GDAL.C.OGRGetDriverCount(), " OGR drivers found") | ||
@test GDAL.C.GDALGetDriverCount() > 0 | ||
@test GDAL.C.OGRGetDriverCount() > 0 | ||
# before being able to use any drivers, they must be registered first | ||
GDAL.allregister() | ||
info(GDAL.getdrivercount(), " GDAL drivers found") | ||
info(GDAL.ogrgetdrivercount(), " OGR drivers found") | ||
@test GDAL.getdrivercount() > 0 | ||
@test GDAL.ogrgetdrivercount() > 0 | ||
|
||
# throw errors on non existing files | ||
@test_throws GDAL.GDALError GDAL.C.GDALOpen(pointer("NonExistent"), GDAL.C.GA_ReadOnly) | ||
@test_throws GDAL.GDALError GDAL.open("NonExistent", GDAL.GA_ReadOnly) | ||
# if a driver is not found, the C API returns a null | ||
@test GDAL.C.GDALGetDriverByName(pointer("NonExistent")) == C_NULL | ||
@test GDAL.C.GDALGetDriverByName("NonExistent") == C_NULL | ||
# whilst the rewritten API throws a GDALError | ||
@test_throws GDAL.GDALError GDAL.getdriverbyname("NonExistent") | ||
|
||
cd(dirname(@__FILE__)) do | ||
isdir("tmp") || mkpath("tmp") # ensure it exists | ||
|
||
include("tutorial_raster.jl") | ||
include("tutorial_vector.jl") | ||
end | ||
|
||
GDAL.destroydrivermanager() |