5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test the Qt tool warnings.
36 test = TestSCons.TestSCons()
38 test.Qt_dummy_installation()
40 test.Qt_create_SConstruct('SConstruct')
42 test.write('aaa.cpp', r"""
43 #include "my_qobject.h"
44 void aaa(void) Q_OBJECT
47 test.write('SConscript', r"""
50 env.StaticLibrary('aaa.cpp')
56 scons: warning: Generated moc file 'aaa.moc' is not included by 'aaa.cpp'
57 """ + TestSCons.file_expr
59 # In case 'ar' gives a warning about creating a library.
60 test.fail_test(not test.match_re(test.stderr(), match12) and \
61 not test.match_re(test.stderr(), match12 + ".+\n"))
63 os.environ['QTDIR'] = test.QT
65 test.run(arguments='-n noqtdir=1')
67 # We'd like to eliminate $QTDIR from the environment as follows:
68 # del os.environ['QTDIR']
69 # But unfortunately, in at least some versions of Python, the Environment
70 # class doesn't implement a __delitem__() method to make the library
71 # call to actually remove the deleted variable from the *external*
72 # environment, so it only gets removed from the Python dictionary.
73 # Consequently, we need to just wipe out its value as follows>
74 os.environ['QTDIR'] = ''
75 test.run(stderr=None, arguments='-n noqtdir=1')
77 moc = test.where_is('moc')
81 scons: warning: Could not detect qt, using moc executable as a hint \(QTDIR=%s\)
82 File "SConstruct", line \d+, in \?
83 """ % string.replace( os.path.dirname(os.path.dirname(moc)), '\\', '\\\\' )
86 scons: warning: Could not detect qt, using empty QTDIR
87 File "SConstruct", line \d+, in \?
90 test.fail_test(not test.match_re(test.stderr(), expect))