def newMapWidgetInContainer(self): """ Return a new SVGMap """ enc = ircweb.IRCContainer(None, testUser(cleanStore())) enc.setFragmentParent(self) return enc
def newMapWidget(self): """ Return a new SVGMap """ st = cleanStore() chan = data.Channel(store=st, name=u'#foo') mapw = svgmap.MapWidget(chan, MockChatEntry()) mapw.setFragmentParent(self) return mapw
def newAccountManager(self, nick=None, autoHide=None): """ Return a new Account Manager """ user = testUser(cleanStore()) if nick is not None: user.nick = nick am = ircweb.AccountManager(MockMinAccountManager(), None, user) am.setFragmentParent(self) return am
def newContainer(self, ): """ Return a new IRC Container with mock conversations for the ids given """ user = testUser(cleanStore()) # XXX warning - livetrial does not provide test isolation! # setting instance variables can bite you in the ass. If this # method is called first from every test, life is fine, but if # generateConversation is called without calling this first, # behavior is UNDEFINED. self.irc = ircweb.IRCContainer(MockMinAccountManager(), user) self.irc.setFragmentParent(self) return self.irc
def newContainer(self,): """ Return a new IRC Container with mock conversations for the ids given """ user = testUser(cleanStore()) # XXX warning - livetrial does not provide test isolation! # setting instance variables can bite you in the ass. If this # method is called first from every test, life is fine, but if # generateConversation is called without calling this first, # behavior is UNDEFINED. self.irc = ircweb.IRCContainer(MockMinAccountManager(), user) self.irc.setFragmentParent(self) return self.irc
def newFileChooser(self, labels=None): """ Return a new Signup widget @param labels: create ChooserIcons with the given labels as well """ # if labels was given, create some test files. FileChooser # will make ChooserIcons out of these during rendering self.store = cleanStore() self.user = testUser(self.store) if labels is not None: for label in labels: fileitem = data.FileMeta(store=self.store, user=self.user, filename=label, mimeType=u"text/plain") self.fc = gmtools.FileChooser(self.user) self.fc.setFragmentParent(self) return self.fc
def newFileChooser(self, labels=None): """ Return a new Signup widget @param labels: create ChooserIcons with the given labels as well """ # if labels was given, create some test files. FileChooser # will make ChooserIcons out of these during rendering self.store = cleanStore() self.user = testUser(self.store) if labels is not None: for label in labels: fileitem = data.FileMeta(store=self.store, user=self.user, filename=label, mimeType=u'text/plain') self.fc = gmtools.FileChooser(self.user) self.fc.setFragmentParent(self) return self.fc
def requestSetMapBackground(self): """ Return a new BackgroundImage object """ st = cleanStore() chan = data.Channel(store=st, name=u'#foo') fileitem = testFileMeta(st) odata = data.FileData(store=st, data=obscurement.newBlackImage(100,100)) obsc = data.FileMeta(store=st, data=odata, filename=u'#foo_obscurement.png', mimeType=u'image/png', md5=u'316ca7b4c921a204797dfbb70becfef9', width=100, height=100, ) chan.background = fileitem chan.obscurement = obsc bgi = svgmap.BackgroundImage(chan) bgi.setFragmentParent(self) return bgi
def requestSetMapBackground(self): """ Return a new BackgroundImage object """ st = cleanStore() chan = data.Channel(store=st, name=u'#foo') fileitem = testFileMeta(st) odata = data.FileData(store=st, data=obscurement.newBlackImage(100, 100)) obsc = data.FileMeta( store=st, data=odata, filename=u'#foo_obscurement.png', mimeType=u'image/png', md5=u'316ca7b4c921a204797dfbb70becfef9', width=100, height=100, ) chan.background = fileitem chan.obscurement = obsc bgi = svgmap.BackgroundImage(chan) bgi.setFragmentParent(self) return bgi