def testProfileChange(self):
     self.topics = [Topic('onProfileChange')]
     self.subscriber.addTopic(self.topics[0])
     self.dispatcher.addSubscriber(self.subscriber)
     settings = Settings()
     flexmock(settings, general={'LoopFreq': 100})
     self.publisher = LoopPublisher(self.dispatcher, settings)
     self.dispatcher.start()
     self.publisher.start()
     time.sleep(5)
     self.publisher.abort()
     self.dispatcher.abort()
     messages = self.subscriber.retrieveMessages()
     msgtopics = [msg.topic for msg in messages]
     for topic in self.topics:
         assert topic in msgtopics
 def testStereoModeChange(self):
     self.topics = [Topic('onStereoModeChange')]
     self.subscriber.addTopic(self.topics[0])
     self.dispatcher.addSubscriber(self.subscriber)
     settings = Settings()
     flexmock(settings, general={'LoopFreq': 100})
     self.publisher = LoopPublisher(self.dispatcher, settings)
     self.dispatcher.start()
     self.publisher.start()
     self.subscriber.waitForMessage(count=1, timeout=5)
     self.publisher.abort()
     self.dispatcher.abort()
     messages = self.subscriber.retrieveMessages()
     msgtopics = [msg.topic for msg in messages]
     for topic in self.topics:
         assert topic in msgtopics
 def testOnWindowClose(self):
     self.topics = [Topic('onWindowClose', 'E1')]
     self.subscriber.addTopic(self.topics[0])
     self.dispatcher.addSubscriber(self.subscriber)
     settings = Settings()
     flexmock(settings, general={'LoopFreq': 100})
     flexmock(settings, getClosewindowids={10001: 'E1'})
     self.publisher = LoopPublisher(self.dispatcher, settings)
     self.dispatcher.start()
     self.publisher.start()
     time.sleep(5)
     self.publisher.abort()
     self.dispatcher.abort()
     messages = self.subscriber.retrieveMessages()
     msgtopics = [msg.topic for msg in messages]
     for topic in self.topics:
         assert topic in msgtopics
 def testOnWindowOpen(self):
     self.topics = [Topic('onWindowOpen', 'E1')]
     self.subscriber.addTopic(self.topics[0])
     self.dispatcher.addSubscriber(self.subscriber)
     settings = Settings()
     flexmock(settings, general={'LoopFreq': 100})
     flexmock(settings, getOpenwindowids={10001: 'E1'})
     self.publisher = LoopPublisher(self.dispatcher, settings)
     self.dispatcher.start()
     self.publisher.start()
     self.subscriber.waitForMessage(count=1, timeout=5)
     self.publisher.abort()
     self.dispatcher.abort()
     messages = self.subscriber.retrieveMessages()
     msgtopics = [msg.topic for msg in messages]
     for topic in self.topics:
         assert topic in msgtopics
 def testLoopIdle(self):
     self.topics = [Topic('onIdle', 'E1'), Topic('onIdle', 'E2')]
     for topic in self.topics:
         self.subscriber.addTopic(topic)
     self.dispatcher.addSubscriber(self.subscriber)
     idleSettings = {'E1': 3, 'E2': 5}
     settings = Settings()
     flexmock(settings, getIdleTimes=idleSettings)
     flexmock(settings, general={'LoopFreq': 100})
     self.publisher = LoopPublisher(self.dispatcher, settings)
     self.dispatcher.start()
     self.publisher.start()
     time.sleep(7)
     self.publisher.abort()
     self.dispatcher.abort()
     messages = self.subscriber.retrieveMessages()
     msgtopics = [msg.topic for msg in messages]
     for topic in self.topics:
         assert topic in msgtopics