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.
27 Test the Qt tool warnings.
35 test
= TestSCons
.TestSCons()
37 SConstruct_path
= test
.workpath('SConstruct')
39 test
.Qt_dummy_installation()
41 test
.Qt_create_SConstruct(SConstruct_path
)
43 test
.write('aaa.cpp', r
"""
44 #include "my_qobject.h"
45 void aaa(void) Q_OBJECT
48 test
.write('SConscript', r
"""
51 env.StaticLibrary('aaa.cpp')
57 scons: warning: Generated moc file 'aaa.moc' is not included by 'aaa.cpp'
58 """ + TestSCons
.file_expr
60 if not re
.search(match12
, test
.stderr()):
61 print("Did not find expected regular expression in stderr:")
65 os
.environ
['QTDIR'] = test
.QT
67 test
.run(arguments
='-n noqtdir=1')
69 # We'd like to eliminate $QTDIR from the environment as follows:
70 # del os.environ['QTDIR']
71 # But unfortunately, in at least some versions of Python, the Environment
72 # class doesn't implement a __delitem__() method to make the library
73 # call to actually remove the deleted variable from the *external*
74 # environment, so it only gets removed from the Python dictionary.
75 # Consequently, we need to just wipe out its value as follows>
76 os
.environ
['QTDIR'] = ''
77 test
.run(stderr
=None, arguments
='-n noqtdir=1')
79 moc
= test
.where_is('moc')
82 qtdir
= os
.path
.dirname(os
.path
.dirname(moc
))
83 qtdir
= qtdir
.replace('\\', '\\\\' )
86 scons: warning: Could not detect qt3, using moc executable as a hint \(QT3DIR=%s\)
87 File "%s", line \d+, in (\?|<module>)
88 """ % (qtdir
, re
.escape(SConstruct_path
))
92 scons: warning: Could not detect qt3, using empty QT3DIR
93 File "%s", line \d+, in (\?|<module>)
94 """ % re
.escape(SConstruct_path
)
96 test
.fail_test(not test
.match_re(test
.stderr(), expect
))
102 # indent-tabs-mode:nil
104 # vim: set expandtab tabstop=4 shiftwidth=4: