// NB TESTS
/* ----- ----- ----- */
//////////////////////
/* ----- ----- ----- */
// PRELIMINARY-PRELIMINARY NOTE: use the "rm -r *" command (in terminal) carefully)
// BE SURE THAT YOU"RE IN THE PROPER DIRECTORY BEFORE RUNNING IT
// BECAUSE "rm -r *" deletes ALL_FILES in a directory
/* ----- ----- ----- */
//////////////////////
/* ----- ----- ----- */
// PRELIMINARY - in terminal
// the result should be bash ... assuming that it is, go on to TEST 1
echo $SHELL
// in terminal .... go to the SuperCollider folder and make an "nb_test" directory
// ... this doesn't have to be done through the terminal .... it's ok to make the directory
// from the Finder (File->NEW FOLDER in the SuperCollider folder)
cd /Applications/SuperCollider
mkdir nb_test
/* ----- ----- ----- */
//////////////////////
/* ----- ----- ----- */
// TEST 1 - in terminal (to show if console.py works (or not)
// evaluate each line, one at a time
// the result should be test.png in /Applicatons/SuperCollider/nb_test/
// if test.png appears in /Appllications/SuperCollider/nb_test, then move on to TEST 2
cd /Applications/SuperCollider/nb_test
pwd
export PYTHONPATH=/Applications/NodeBox/NodeBox.app/Contents/Resources/
echo $PYTHONPATH
python /Applications/SuperCollider/nb_test/console.py test.py test.png
/* ----- ----- ----- */
//////////////////////
/* ----- ----- ----- */
// TEST 2 - move to this step only if TEST 1 succeeds
// the result of this test should be a "test2.py" file in the /tmp/ directory
// FIRST, evaluate each line in terminal
// - the first line goes to the /tmp directory
// - the second line deletes all files in the /tmp directory (so that we have a "clean"
// workspace to start
// - the third line verifies that nothing is in /tmp (ls should return a "blank" line)
cd /tmp
rm -r *
ls
// then, in SuperCollider ... success is an open window (with code) in NodeBox
// AND, look in /tmp. Is "test2.py" there? (then we have complete success).
(
NB("test2", 320, 240);
n.background(1, 1, 1);
n.fill(1, 0, 0);
n.rect(10, 10, 100, 100);
n.fill(0, 0, 0);
n.text("I am the 2nd test", 10, 140);
n.displayCode
)
/* ----- ----- ----- */
//////////////////////
/* ----- ----- ----- */
// TEST 3 - move to this step only if TEST 2 succeeds
// first, in terminal (delete all files in /tmp and verify that nothing is there)
cd /tmp
rm -r *
ls
// then, in SuperCollider ... success will be a "test3.png" file in /tmp
(
n = NB("test3", 320, 240);
n.background(0, 0, 0);
n.fill(0, 0, 1);
n.rect(10, 10, 100, 100);
n.fill(1, 1, 1);
n.text("This is the 3rd test", 10, 140);
n.render
)
// then, in SuperCollider (this should show, in the Post window, that a "test3.png" file is in /tmp
"ls /tmp/".unixCmd
// assuming the "test3.png" file _IS in /tmp ...
// (in SuperCollider)
"open /tmp/test3.png".systemCmd
/* ----- ----- ----- */
//////////////////////
/* ----- ----- ----- */
// TEST 4 - move to this step only if TEST 3 succeeds
(
n = NB("test4", 320, 240);
n.background(0, 0, 0);
n.fill(1, 0, 1);
n.rect(10, 10, 100, 100);
n.fill(1, 1, 1);
n.text("TEST NO. 4", 10, 140);
n.render;
n.openWith("Preview")
)
// IF this test _FAILS, look in the /tmp directory. Is "test4.png" there?
/* ----- ----- ----- */
//////////////////////
/* ----- ----- ----- */
// TEST 5 - move to this step only if TEST 4 _succeeds
(
n = NB("test5", 320, 240, true, "pdf");
n.background(0, 0, 0);
n.fill(1, 0, 1);
n.rect(10, 10, 100, 100);
n.fill(1, 1, 1);
n.fontsize(12);
n.text("GOOD NEWS! EVERYTHING WORKS!!", 10, 140);
n.renderAndDisplayImage
)
// IF this test _FAILS, look in the /tmp directory. Is "test5.png" there?