~ubuntu-branches/ubuntu/quantal/mago/quantal

« back to all changes in this revision

Viewing changes to totem/totem_basics.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2010-12-03 16:08:32 UTC
  • Revision ID: james.westby@ubuntu.com-20101203160832-97pz2nxwmo54iwfk
Tags: 0.3-0ubuntu3
* Updated from trunk
 + Added new applications to our tests base
 + Fixes LP: #682845 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
import os
 
3
from time import time, gmtime, strftime
 
4
 
 
5
from mago.test_suite.totem import TotemTestSuite 
 
6
 
 
7
class TotemBasics(TotemTestSuite):
 
8
    def check_audio_playback(self):
 
9
        test_file = strftime(
 
10
            "/tmp/" + "%Y%m%d_%H%M%S" + ".wav", gmtime((time())))
 
11
        self.application.openfile(self.wavfile)
 
12
        (freq, flat) = self.application.capture_do_fft(test_file)
 
13
        if freq != self.freq:
 
14
            raise AssertionError, "Sine WAV playback error, frq expected: %s ; got %s" % (self.freq, freq)
 
15
        self.application.play_pause()
 
16
        os.unlink(test_file)
 
17
        (freq, flat) = self.application.capture_do_fft(test_file)
 
18
        if flat != 1:
 
19
            raise AssertionError, "Pause playback error, non flat PCM detected"  
 
20
        self.application.play_pause()
 
21
        os.unlink(test_file)
 
22
if __name__ == "__main__":
 
23
    totem_test =  TotemBasics()
 
24
    totem_test.run()