5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 Validate that a stripped-down real-world Qt configuation (thanks
29 to Leanid Nazdrynau) with a generated .h file is correctly
30 up-to-date after a build.
32 (This catches a bug that was introduced during a signature refactoring
42 test
= TestSCons
.TestSCons()
44 if not os
.environ
.get('QTDIR', None):
45 x
="External environment variable $QTDIR not set; skipping test(s).\n"
50 ['layer', 'aclock', 'qt_bug'])
52 test
.write('SConstruct', """\
56 env=Environment(tools=['default','expheaders','qt3'],toolpath=[aa])
57 env["EXP_HEADER_ABS"]=os.path.join(os.getcwd(),'include')
58 if not os.access(env["EXP_HEADER_ABS"],os.F_OK):
59 os.mkdir (env["EXP_HEADER_ABS"])
61 env.SConscript('layer/aclock/qt_bug/SConscript')
64 test
.write('expheaders.py', """\
66 def ExpHeaderScanner(node, env, path):
69 HeaderAction=SCons.Action.Action([SCons.Defaults.Copy('$TARGET','$SOURCE'),SCons.Defaults.Chmod('$TARGET',0o755)])
70 HeaderBuilder= SCons.Builder.Builder(action=HeaderAction)
71 env['BUILDERS']['ExportHeaders'] = HeaderBuilder
76 test
.write(['layer', 'aclock', 'qt_bug', 'SConscript'], """\
80 env.ExportHeaders(os.path.join(env["EXP_HEADER_ABS"],'main.h'), 'main.h')
81 env.ExportHeaders(os.path.join(env["EXP_HEADER_ABS"],'migraform.h'), 'migraform.h')
82 env.Append(CPPPATH=env["EXP_HEADER_ABS"])
83 env.StaticLibrary('all',['main.ui','migraform.ui','my.cc'])
86 test
.write(['layer', 'aclock', 'qt_bug', 'main.ui'], """\
87 <!DOCTYPE UI><UI version="3.3" stdsetdef="1">
89 <widget class="QWizard">
90 <property name="name">
91 <cstring>Main</cstring>
93 <property name="geometry">
103 <include location="local" impldecl="in implementation">migraform.h</include>
108 test
.write(['layer', 'aclock', 'qt_bug', 'migraform.ui'], """\
109 <!DOCTYPE UI><UI version="3.3" stdsetdef="1">
110 <class>MigrateForm</class>
111 <widget class="QWizard">
112 <property name="name">
113 <cstring>MigrateForm</cstring>
115 <property name="geometry">
127 test
.write(['layer', 'aclock', 'qt_bug', 'my.cc'], """\
131 my_obj
= 'layer/aclock/qt_bug/my' + _obj
133 test
.run(arguments
='--warn=no-tool-qt-deprecated ' + my_obj
, stderr
=None)
135 expect
= my_obj
.replace('/', os
.sep
)
136 test
.up_to_date(options
='--debug=explain', arguments
=expect
, stderr
=None)
142 # indent-tabs-mode:nil
144 # vim: set expandtab tabstop=4 shiftwidth=4: