[ci skip] update generated files
[scons.git] / test / QT / qt3 / generated-ui.py
blobd43b21b000054711df45cba48e02ca3cace1ee02
1 #!/usr/bin/env python
3 # MIT License
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.
26 """
27 Test that the UI scanning logic correctly picks up scansG
28 """
30 import os
32 import TestSCons
34 test = TestSCons.TestSCons()
36 if not os.environ.get('QTDIR', None):
37 x ="External environment variable $QTDIR not set; skipping test(s).\n"
38 test.skip_test(x)
40 test.subdir(['layer'],
41 ['layer', 'aclock'],
42 ['layer', 'aclock', 'qt_bug'])
44 test.write(['SConstruct'], """\
45 import os
46 aa=os.getcwd()
48 env=Environment(tools=['default','expheaders','qt3'],toolpath=[aa])
49 if 'HOME' in os.environ:
50 env['ENV']['HOME'] = os.environ['HOME']
51 env["EXP_HEADER_ABS"]=os.path.join(os.getcwd(),'include')
52 if not os.access(env["EXP_HEADER_ABS"],os.F_OK):
53 os.mkdir (env["EXP_HEADER_ABS"])
54 Export('env')
55 env.SConscript('layer/aclock/qt_bug/SConscript')
56 """)
58 test.write(['expheaders.py'], """\
59 import SCons.Defaults
60 def ExpHeaderScanner(node, env, path):
61 return []
62 def generate(env):
63 HeaderAction=SCons.Action.Action([SCons.Defaults.Copy('$TARGET','$SOURCE'),SCons.Defaults.Chmod('$TARGET',0o755)])
64 HeaderBuilder= SCons.Builder.Builder(action=HeaderAction)
65 env['BUILDERS']['ExportHeaders'] = HeaderBuilder
66 def exists(env):
67 return 0
68 """)
70 test.write(['layer', 'aclock', 'qt_bug', 'SConscript'], """\
71 import os
73 Import ("env")
74 #src=os.path.join(env.Dir('.').srcnode().abspath, 'testfile.h')
75 env.ExportHeaders(os.path.join(env["EXP_HEADER_ABS"],'main.h'), 'main.h')
76 env.ExportHeaders(os.path.join(env["EXP_HEADER_ABS"],'migraform.h'), 'migraform.h')
77 env.Append(CPPPATH=env["EXP_HEADER_ABS"])
78 env.StaticLibrary('all',['main.ui','migraform.ui'])
79 """)
81 test.write(['layer', 'aclock', 'qt_bug', 'main.ui'], """\
82 <!DOCTYPE UI><UI version="3.3" stdsetdef="1">
83 <class>Main</class>
84 <widget class="QWizard">
85 <property name="name">
86 <cstring>Main</cstring>
87 </property>
88 <property name="geometry">
89 <rect>
90 <x>0</x>
91 <y>0</y>
92 <width>600</width>
93 <height>385</height>
94 </rect>
95 </property>
96 </widget>
97 <includes>
98 <include location="local" impldecl="in implementation">migraform.h</include>
99 </includes>
100 </UI>
101 """)
103 test.write(['layer', 'aclock', 'qt_bug', 'migraform.ui'], """\
104 <!DOCTYPE UI><UI version="3.3" stdsetdef="1">
105 <class>MigrateForm</class>
106 <widget class="QWizard">
107 <property name="name">
108 <cstring>MigrateForm</cstring>
109 </property>
110 <property name="geometry">
111 <rect>
112 <x>0</x>
113 <y>0</y>
114 <width>%s</width>
115 <height>385</height>
116 </rect>
117 </property>
118 </widget>
119 </UI>
120 """)
122 test.run(
123 stderr=TestSCons.noisy_ar,
124 match=TestSCons.match_re_dotall,
127 test.up_to_date(arguments=".")
129 test.pass_test()
131 # Local Variables:
132 # tab-width:4
133 # indent-tabs-mode:nil
134 # End:
135 # vim: set expandtab tabstop=4 shiftwidth=4: