Skip to content

Commit

Permalink
Moving source code from Windmill project.
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Mar 29, 2010
1 parent 121c1fd commit 6fa5fe0
Show file tree
Hide file tree
Showing 28 changed files with 3,280 additions and 0 deletions.
60 changes: 60 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python

import optparse
import os
import re
import shutil

# Location of compiler
MXMLC_PATH = 'mxmlc -debug -verbose-stacktraces -incremental=true -compiler.strict -compiler.show-actionscript-warnings'

# For replacing .as with .swf
as_re = re.compile('\.as$|\.mxml$')

def windmill():
cmd = MXMLC_PATH + ' -source-path=. ./org/windmill/Windmill.as -o ./org/windmill/Windmill.swf'
os.system(cmd)

def bootstrap():
cmd = MXMLC_PATH + ' -source-path=. ./org/windmill/WMBootstrap.as -o ./org/windmill/WMBootstrap.swf'
os.system(cmd)

def clean():
for root, dirs, file_list in os.walk('./'):
for file in file_list:
if file.endswith('.swf') or file.endswith('.swc') or file.endswith('.swf.cache'):
path = root + '/' + file
cmd = 'rm ' + path
#print cmd
os.system(cmd)

def parse_opts():
parser = optparse.OptionParser()
parser.add_option('-t', '--target', dest='target',
help='build TARGET (windmill/bootstrap/all/clean, default is all)',
metavar='TARGET', choices=('windmill', 'bootstrap', 'all', 'clean'), default='all')
opts, args = parser.parse_args()
return opts, args

def main(o, a):
target = o.target
# Build only the AS tests into loadable swfs
if target == 'windmill':
windmill()
# Build only the test app we use to run the tests against
elif target == 'bootstrap':
bootstrap()
# Build everything, natch
elif target == 'all':
windmill()
bootstrap()
# Clean out any swfs in the directory
elif target == 'clean':
clean()
else:
print 'Not a valid target.'

if __name__ == "__main__":
main(*parse_opts())


41 changes: 41 additions & 0 deletions org/windmill/TestCase.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2009, Matthew Eernisse ([email protected]) and Slide, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package org.windmill {
import flash.display.Sprite;
import flash.display.Stage;
import org.windmill.Windmill;
import org.windmill.WMAssert;
import org.windmill.WMWait;
import org.windmill.astest.ASTest;
public class TestCase extends Sprite {
public var windmill:* = Windmill;
public var asserts:* = WMAssert;
public var waits:* = WMWait;
public var controller:* = ASTest.wrappedControllerMethods;
// Reference to either an Application (Flex)
// or the Stage (Flash)
public var context:* = Windmill.getContext();
// Get a reference to the Stage in the base class
// before the tests actually load so tests can all
// reference it
private var fakeStage:Stage = Windmill.getStage();
override public function get stage():Stage {
return fakeStage;
}
}
}

Loading

0 comments on commit 6fa5fe0

Please sign in to comment.