diff options
| author | Adam Vandenberg | 2010-10-25 09:28:50 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-10-26 09:35:50 -0700 |
| commit | d89bcba4ef99dc1e8ecce8733350d06b664431bf (patch) | |
| tree | 1f57b6169635aed68e73f76886d30a27c1670d9b /Library/Formula/pyqt.rb | |
| parent | 3f16d53109a5df1f3ecd5302355e8aef4160626b (diff) | |
| download | homebrew-d89bcba4ef99dc1e8ecce8733350d06b664431bf.tar.bz2 | |
pyqt - add test
Diffstat (limited to 'Library/Formula/pyqt.rb')
| -rw-r--r-- | Library/Formula/pyqt.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Library/Formula/pyqt.rb b/Library/Formula/pyqt.rb index fb31af72c..fc2b988af 100644 --- a/Library/Formula/pyqt.rb +++ b/Library/Formula/pyqt.rb @@ -27,4 +27,46 @@ This formula won't function until you amend your PYTHONPATH like so: export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/python:$PYTHONPATH EOS end + + def test + test_program = <<-EOS +#!/usr/bin/env python +# Taken from: http://zetcode.com/tutorials/pyqt4/firstprograms/ + +import sys +from PyQt4 import QtGui, QtCore + + +class QuitButton(QtGui.QWidget): + def __init__(self, parent=None): + QtGui.QWidget.__init__(self, parent) + + self.setGeometry(300, 300, 250, 150) + self.setWindowTitle('Quit button') + + quit = QtGui.QPushButton('Close', self) + quit.setGeometry(10, 10, 60, 35) + + self.connect(quit, QtCore.SIGNAL('clicked()'), + QtGui.qApp, QtCore.SLOT('quit()')) + + +app = QtGui.QApplication(sys.argv) +qb = QuitButton() +qb.show() +app.exec_() +sys.exit(0) + EOS + + ohai "Writing test script 'test_pyqt.py'." + open("test_pyqt.py", "w+") do |file| + file.write test_program + end + + ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/python", ':' + system "python test_pyqt.py" + + ohai "Removing test script 'test_pyqt.py'." + rm "test_pyqt.py" + end end |
