# Run with ./run-tests.sh

test_ocr_on_live_video() {
    cat > test.py <<-EOF
	import stbt
	
	stbt.frames(timeout_secs=60).next()  # wait 'til video pipeline playing
	text = stbt.ocr()
	assert text == "Hello there", "Unexpected text: %s" % text
	
	text = stbt.ocr(region=stbt.Region(x=70, y=180, width=90, height=40))
	assert text == "Hello", "Unexpected text: %s" % text
	EOF
    stbt run -v \
        --source-pipeline="videotestsrc pattern=black ! \
                video/x-raw,format=BGR ! \
                textoverlay text=Hello\ there font-desc=Sans\ 48" \
        test.py
}

# Run with ./run-tests.sh

test_ocr_on_live_video() {
    cat > test.py <<-EOF
	import stbt
	
	stbt.frames(timeout_secs=30).next()  # wait 'til video pipeline playing
	text = stbt.ocr()
	assert text == "Hello there", "Unexpected text: %s" % text
	
	text = stbt.ocr(region=stbt.Region(x=70, y=180, width=90, height=40))
	assert text == "Hello", "Unexpected text: %s" % text
	EOF
    stbt run -v \
        --source-pipeline="videotestsrc pattern=black ! \
                video/x-raw,format=BGR ! \
                textoverlay text=Hello\ there font-desc=Sans\ 48" \
        test.py
}

--- 
+++ 
@@ -4,7 +4,7 @@
     cat > test.py <<-EOF
 	import stbt
 	
-	stbt.frames(timeout_secs=60).next()  # wait 'til video pipeline playing
+	stbt.frames(timeout_secs=30).next()  # wait 'til video pipeline playing
 	text = stbt.ocr()
 	assert text == "Hello there", "Unexpected text: %s" % text
 	
test_ocr_on_live_video: Increase timeout when run under load

a0d44c71 increased this timeout because I got a NoVideo timeout when
running under heavy load (`make check` with GNU parallel installed).
If it fails again with this ridiculously long timeout then there's
probably a bug in the GStreamer textoverlay element or somewhere else.
