Commit 1b9700a7 authored by Philipp Gast's avatar Philipp Gast
Browse files

added the keyword tests for a synced figure

parent fb8dd682
Pipeline #479 passed with stage
in 4 minutes and 21 seconds
......@@ -294,7 +294,7 @@ class MyFig_client(Figure):
# FORMAT RAW DATA --------------------------------------------------
def formatRawData(self):
# HEre comes a function that send a signal to the server
# Here comes a function that send a signal to the server
# and tells him to execute the format rawdata of the
# synchronized figure (server-side)
if (self.client is not None) and (self.syncID != -1):
......
......@@ -29,6 +29,7 @@ class ComSetupTestCase(unittest.TestCase):
self.server.run(as_daemon=True)
def test_ConnectionSetup(self):
""" Test the basic connection functions"""
print('REQUEST CONNECTION...')
self.client.connect(('localhost', 12345))
print('CONNECTED')
......@@ -55,40 +56,53 @@ class RemoteFigTestCase(unittest.TestCase):
self.client.port = 12345
self.server.run(as_daemon=True)
self.client.connect(('localhost', 12347))
self.client.connect(('localhost',12347))
self.datanames = ['data1','data2']
self.client.readData('readStupidData', self.datanames[0])
self.client.readData('readStupidData2', self.datanames[1])
def test_Readdata(self):
""" Check wether the reading of remote data results in the server creating the datasets """
rm_data = self.client.listRemoteData()
self.assertEqual(rm_data,self.datanames)
def test_NewSyncFig(self):
''' Create a frist synced figure. Test if formating it will result in clinetside.fig.ax.data holding the expected data.'''
fig1 = self.client.newSyncFigure(FigTestc, ('data1',))
self.assertIsInstance(fig1,FigTestc)
fig1.formatRawData()
self.assertEqual(fig1.getAxesByName('p1').data,
{'xdata': [-1, 1],'ydata': [1, -1]})
def test_MultiFig(self):
""" test if a figure with two axes is created correctly and if the alias set the axis keywords correct during creation """
fig2 = self.client.newSyncFigure(FigTestc2, ('data1','data2'), xRange_p1=[-2.0, 2.0], xRange_p2=[-3, 3], yRange=[-2.0, 2.0])
self.assertIsInstance(fig2,FigTestc2)
self.assertEqual(len(fig2.get_axes()),2)
# Testing the Alias functionality
#~ self.assertEqual(fig2.getAxesByName('p1').keywords['xRange'],[-2.0, 2.0])
#~ self.assertEqual(fig2.getAxesByName('p2').keywords['xRange'],[-3, 3])
#~ self.assertEqual(fig2.getAxesByName('p1').keywords['yRange'],[-2.0, 2.0])
#~ self.assertEqual(fig2.getAxesByName('p2').keywords['yRange'],[-2.0, 2.0])
self.assertEqual(self.server.getFigByID(str(fig2.syncID)).getAxesByName('p1').keywords['xRange'],[-2, 2])
self.assertEqual(self.server.getFigByID(str(fig2.syncID)).getAxesByName('p1').keywords['yRange'],[-2, 2])
self.assertEqual(self.server.getFigByID(str(fig2.syncID)).getAxesByName('p2').keywords['xRange'],[-3, 3])
self.assertEqual(self.server.getFigByID(str(fig2.syncID)).getAxesByName('p2').keywords['yRange'],[-2, 2])
# compare client and server side keywords
self.assertEqual(fig2.getAxesByName('p1').keywords,self.server.getFigByID(str(fig2.syncID)).getAxesByName('p1').keywords)
self.assertEqual(fig2.getAxesByName('p2').keywords,self.server.getFigByID(str(fig2.syncID)).getAxesByName('p2').keywords)
def test_Update(self):
""" test wether a serarate update call will set keywords correct"""
fig1 = self.client.newSyncFigure(FigTestc, ('data1',))
fig1.update(xRange=[-2, 2],yRange=[-2, 2])
self.assertEqual(self.server.getFigByID(str(fig1.syncID)).getAxesByName('p1').keywords['xRange'],[-2, 2])
self.assertEqual(self.server.getFigByID(str(fig1.syncID)).getAxesByName('p1').keywords['yRange'],[-2, 2])
# compare client and server side keywords
self.assertEqual(fig1.getAxesByName('p1').keywords,self.server.getFigByID(str(fig1.syncID)).getAxesByName('p1').keywords)
#~ def test_ReSync(self):
#~ fig1 = self.client.newSyncFigure(FigTestc, ('data1',))
#~ fig1.deSyncFig()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment