- Timestamp:
- May 1, 2017 4:20:03 AM (8 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- d48cc19
- Parents:
- 28a09b0
- Location:
- src/sas/qtgui
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py
r28a09b0 r0a6e097 16 16 from UnitTesting.TestUtils import QtSignalSpy 17 17 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 18 from GenericScatteringCalculator import GenericScatteringCalculator19 from GenericScatteringCalculator import Plotter3D18 from sas.qtgui.Calculators.GenericScatteringCalculator import GenericScatteringCalculator 19 from sas.qtgui.Calculators.GenericScatteringCalculator import Plotter3D 20 20 21 21 from sas.sasgui.guiframe.data_manager import DataManager 22 from GuiManager import GuiManager23 from sas.qtgui. GuiUtils import *22 from sas.qtgui.MainWindow.GuiManager import GuiManager 23 from sas.qtgui.Utilities.GuiUtils import * 24 24 from sas.sascalc.calculator import sas_gen 25 25 … … 173 173 Load sld data and check modifications of GUI 174 174 """ 175 filename = "../../../sasview/test/save_states/sld_file.sld"175 filename = os.path.join("UnitTesting", "sld_file.sld") 176 176 QtGui.QFileDialog.getOpenFileName = MagicMock(return_value=filename) 177 177 self.widget.loadFile() … … 205 205 # Mx,y,z x,y,znodes and x,y,zstepsize buttons 206 206 self.assertFalse(self.widget.txtMx.isEnabled()) 207 self.assert Equal(self.widget.txtMx.text(), '8.0795e-07')207 self.assertAlmostEqual(float(self.widget.txtMx.text()), 8.0795e-07, 4) 208 208 self.assertFalse(self.widget.txtMy.isEnabled()) 209 self.assert Equal(self.widget.txtMy.text(), '8.0795e-07')209 self.assertAlmostEqual(float(self.widget.txtMy.text()), 8.0795e-07, 4) 210 210 self.assertFalse(self.widget.txtMz.isEnabled()) 211 self.assert Equal(self.widget.txtMz.text(), '3.1739e-07')211 self.assertAlmostEqual(float(self.widget.txtMz.text()), 3.1739e-07, 4) 212 212 self.assertTrue(self.widget.txtNucl.isEnabled()) 213 213 self.assertEqual(self.widget.txtNucl.text(), '0') … … 236 236 Load pdb data and check modifications of GUI 237 237 """ 238 filename = "diamdsml.pdb" 238 filename = os.path.join("UnitTesting", "diamdsml.pdb") 239 239 240 QtGui.QFileDialog.getOpenFileName = MagicMock(return_value=filename) 240 241 self.widget.loadFile() … … 275 276 self.assertEqual(self.widget.txtMz.text(), '0') 276 277 self.assertFalse(self.widget.txtNucl.isEnabled()) 277 self.assert Equal(self.widget.txtNucl.text(), '7.0003e-06')278 self.assertAlmostEqual(float(self.widget.txtNucl.text()), 7.0003e-06, 4) 278 279 279 280 self.assertFalse(self.widget.txtXnodes.isEnabled()) … … 298 299 Load omf data and check modifications of GUI 299 300 """ 300 filename = "../../../sasview/test/1d_data/A_Raw_Example-1.omf" 301 filename = os.path.join("UnitTesting", "A_Raw_Example-1.omf") 302 301 303 QtGui.QFileDialog.getOpenFileName = MagicMock(return_value=filename) 302 304 self.widget.loadFile() … … 325 327 # Mx,y,z x,y,znodes and x,y,zstepsize buttons 326 328 self.assertFalse(self.widget.txtMx.isEnabled()) 327 self.assert Equal(self.widget.txtMx.text(), '7.855e-09')329 self.assertAlmostEqual(float(self.widget.txtMx.text()), 7.855e-09, 4) 328 330 self.assertFalse(self.widget.txtMy.isEnabled()) 329 self.assert Equal(self.widget.txtMy.text(), '4.5169e-08')331 self.assertAlmostEqual(float(self.widget.txtMy.text()), 4.517e-08, 4) 330 332 self.assertFalse(self.widget.txtMz.isEnabled()) 331 self.assert Equal(self.widget.txtMz.text(), '9.9511e-10')333 self.assertAlmostEqual(float(self.widget.txtMz.text()), 9.9511e-10, 4) 332 334 self.assertTrue(self.widget.txtNucl.isEnabled()) 333 335 self.assertEqual(self.widget.txtNucl.text(), '0') … … 364 366 """ 365 367 # load data 366 filename = "diamdsml.pdb" 368 filename = os.path.join("UnitTesting", "diamdsml.pdb") 369 367 370 QtGui.QFileDialog.getOpenFileName = MagicMock(return_value=filename) 368 371 self.widget.loadFile() … … 383 386 """ 384 387 self.assertFalse(self.widget.cmdDraw.isEnabled()) 385 # filename = "../../../sasview/test/upcoming_formats/dna.pdb" 386 filename = "diamdsml.pdb" 388 filename = os.path.join("UnitTesting", "diamdsml.pdb") 387 389 QtGui.QFileDialog.getOpenFileName = MagicMock(return_value=filename) 388 390 self.widget.loadFile() … … 403 405 Test Save feature to .sld file 404 406 """ 405 filename = "../../../sasview/test/save_states/sld_file.sld" 407 filename = os.path.join("UnitTesting", "sld_file.sld") 408 406 409 QtGui.QFileDialog.getOpenFileName = MagicMock(return_value=filename) 407 410 self.widget.loadFile() … … 409 412 time.sleep(0.1) 410 413 411 filename1 = " ../../../sasview/test/save_states/test"414 filename1 = "test" 412 415 QtGui.QFileDialog.getSaveFileName = MagicMock(return_value=filename1) 413 416 … … 417 420 self.assertTrue(os.path.getsize(filename1 + '.sld') > 0) 418 421 419 os.remove(" ../../../sasview/test/save_states/test.sld")422 os.remove("test.sld") 420 423 421 424
Note: See TracChangeset
for help on using the changeset viewer.