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-02-08 15:44:57 +00:00
|
|
|
premake.escaper(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 [[
|
2014-06-11 20:05:25 +00:00
|
|
|
<ResourceCompile>
|
|
|
|
</ResourceCompile>
|
2012-01-27 18:37:24 +00:00
|
|
|
]]
|
|
|
|
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 [[
|
2014-06-11 20:05:25 +00:00
|
|
|
<ResourceCompile>
|
|
|
|
<PreprocessorDefinitions>DEBUG;RESOURCES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
2012-01-27 18:37:24 +00:00
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If include directories are specified, the <AdditionalIncludeDirectories> should be added.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.additionalIncludeDirs_onIncludeDirs()
|
|
|
|
includedirs { "include/lua" }
|
|
|
|
resincludedirs { "include/zlib" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
2014-06-11 20:05:25 +00:00
|
|
|
<ResourceCompile>
|
|
|
|
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
2012-01-27 18:37:24 +00:00
|
|
|
]]
|
|
|
|
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 [[
|
2014-06-11 20:05:25 +00:00
|
|
|
<ResourceCompile>
|
|
|
|
<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 [[
|
2014-06-11 20:05:25 +00:00
|
|
|
<ResourceCompile>
|
|
|
|
<Culture>0x0409</Culture>
|
2014-02-06 20:38:51 +00:00
|
|
|
]]
|
|
|
|
end
|