Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions
test_misc.TestSampleComponent Class Reference

List of all members.

Public Member Functions

def testSampleComponentFlat
def testSampleComponentOld
def testHashJS
def testHashCPP

Private Member Functions

def _doTestSampleComponent
def _doTestHash

Detailed Description

Definition at line 118 of file test_misc.py.


Member Function Documentation

def test_misc.TestSampleComponent._doTestHash (   self,
  c 
) [private]

Definition at line 141 of file test_misc.py.

00141 
00142     def _doTestHash(self, c):
00143         "Test that hashing COM objects works"
00144         d = {}
00145         d[c] = None
00146         if not d.has_key(c):
00147             raise RuntimeError, "Can't get the exact same object back!"
00148         if not d.has_key(c.queryInterface(xpcom.components.interfaces.nsISupports)):
00149             raise RuntimeError, "Can't get back as nsISupports"
00150 
00151         # And the same in reverse - stick an nsISupports in, and make sure an explicit interface comes back.
00152         d = {}
00153 #        contractid = "@mozilla.org/sample;1" # The C++ version.
00154 #        c = xpcom.components.classes[contractid].createInstance() \
00155 #            .queryInterface(xpcom.components.interfaces.nsISupports)
00156         d[c] = None
00157         if not d.has_key(c):
00158             raise RuntimeError, "Can't get the exact same object back!"
00159         if not d.has_key(c.queryInterface(xpcom.components.interfaces.nsISample)):
00160             raise RuntimeError, "Can't get back as nsISupports"

Here is the caller graph for this function:

def test_misc.TestSampleComponent._doTestSampleComponent (   self,
  test_flat = 0 
) [private]
Test the standard Netscape 'sample' sample

Definition at line 119 of file test_misc.py.

00119 
00120     def _doTestSampleComponent(self, test_flat = 0):
00121         """Test the standard Netscape 'sample' sample"""
00122         c = get_sample_component_cpp()
00123         if c is None:
00124             return
00125         if not test_flat:
00126             c = c.queryInterface(xpcom.components.interfaces.nsISample)
00127         self.failUnlessEqual(c.value, "initial value")
00128         c.value = "new value"
00129         self.failUnlessEqual(c.value, "new value")
00130         c.poke("poked value")
00131         self.failUnlessEqual(c.value, "poked value")
00132         c.writeValue("Python just poked:")

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 165 of file test_misc.py.

00165 
00166     def testHashCPP(self):
00167         c = get_sample_component_cpp()
00168         if c is not None:
00169             self._doTestHash(c)
00170 

Here is the call graph for this function:

Definition at line 161 of file test_misc.py.

00161 
00162     def testHashJS(self):
00163         c = get_sample_component_js()
00164         self._doTestHash(c)

Here is the call graph for this function:

Test the standard Netscape 'sample' sample using interface flattening

Definition at line 133 of file test_misc.py.

00133 
00134     def testSampleComponentFlat(self):
00135         """Test the standard Netscape 'sample' sample using interface flattening"""
00136         self._doTestSampleComponent(1)

Here is the call graph for this function:

Test the standard Netscape 'sample' sample using explicit QI

Definition at line 137 of file test_misc.py.

00137 
00138     def testSampleComponentOld(self):
00139         """Test the standard Netscape 'sample' sample using explicit QI"""
00140         self._doTestSampleComponent(0)
    

Here is the call graph for this function:


The documentation for this class was generated from the following file: