2012-01-27 18:37:24 +00:00
|
|
|
--
|
|
|
|
-- tests/actions/vstudio/vc2010/test_resource_compile.lua
|
|
|
|
-- Validate resource compiler settings in Visual Studio 2010 C/C++ projects.
|
2013-03-07 17:14:03 +00:00
|
|
|
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
2012-01-27 18:37:24 +00:00
|
|
|
--
|
|
|
|
|
2013-03-07 17:14:03 +00:00
|
|
|
local suite = test.declare("vs2010_resource_compiler")
|
2012-01-27 18:37:24 +00:00
|
|
|
local vc2010 = premake.vstudio.vc2010
|
2013-09-13 15:15:36 +00:00
|
|
|
local project = premake.project
|
2012-01-27 18:37:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup
|
|
|
|
--
|
|
|
|
|
2013-11-14 13:52:55 +00:00
|
|
|
local sln, prj
|
2012-01-27 18:37:24 +00:00
|
|
|
|
|
|
|
function suite.setup()
|
2014-01-10 15:40:45 +00:00
|
|
|
io.esc = premake.vstudio.vs2010.esc
|
2012-01-27 18:37:24 +00:00
|
|
|
sln, prj = test.createsolution()
|
|
|
|
end
|
|
|
|
|
2013-03-07 17:14:03 +00:00
|
|
|
local function prepare()
|
2013-11-14 13:52:55 +00:00
|
|
|
local cfg = test.getconfig(prj, "Debug")
|
2012-01-27 18:37:24 +00:00
|
|
|
vc2010.resourceCompile(cfg)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check the basic element structure with default settings.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.defaultSettings()
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ResourceCompile>
|
|
|
|
</ResourceCompile>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-04-03 15:53:00 +00:00
|
|
|
|
2012-01-27 18:37:24 +00:00
|
|
|
--
|
|
|
|
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.preprocessorDefinitions_onDefines()
|
|
|
|
defines { "DEBUG" }
|
|
|
|
resdefines { "RESOURCES" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ResourceCompile>
|
|
|
|
<PreprocessorDefinitions>DEBUG;RESOURCES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If include directories are specified, the <AdditionalIncludeDirectories> should be added.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.additionalIncludeDirs_onIncludeDirs()
|
|
|
|
includedirs { "include/lua" }
|
|
|
|
resincludedirs { "include/zlib" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ResourceCompile>
|
|
|
|
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
|
|
]]
|
|
|
|
end
|
2013-03-07 17:14:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Xbox 360 doesn't use the resource compiler.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.skips_onXbox360()
|
|
|
|
system "Xbox360"
|
|
|
|
prepare()
|
|
|
|
test.isemptycapture()
|
|
|
|
end
|
2013-04-30 16:25:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Test special escaping for preprocessor definition with quotes.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.preprocessorDefinitions_onDefinesEscaping()
|
2013-05-22 15:15:48 +00:00
|
|
|
defines { 'VERSION_STRING="1.0.0 (testing)"' }
|
2013-04-30 16:25:25 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ResourceCompile>
|
2013-05-22 15:15:48 +00:00
|
|
|
<PreprocessorDefinitions>VERSION_STRING=\"1.0.0 (testing)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
2013-04-30 16:25:25 +00:00
|
|
|
]]
|
|
|
|
end
|
2014-02-06 20:38:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Test locale conversion to culture codes.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.culture_en_US()
|
|
|
|
locale "en-US"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ResourceCompile>
|
|
|
|
<Culture>0x0409</Culture>
|
|
|
|
]]
|
|
|
|
end
|