Skip to content

Commit

Permalink
Agregado test que verificar que todos los datos se guardan al editar un
Browse files Browse the repository at this point in the history
elemento. fixes #88..
  • Loading branch information
tranfuga25s committed May 16, 2014
1 parent 714ee5a commit 5f66041
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions plugins/proveedor/formmodificarproveedor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "eactcerrar.h"
#include "eactguardar.h"

FormModificarProveedor::FormModificarProveedor( MProveedor *m, QWidget *parent) :
FormModificarProveedor::FormModificarProveedor( MProveedor *m, QWidget *parent, bool test ) :
EVentana(parent), Ui::FormProveedorBase()
{
setupUi(this);
Expand All @@ -28,6 +28,8 @@ FormModificarProveedor::FormModificarProveedor( MProveedor *m, QWidget *parent)
mapa->setSubmitPolicy( QDataWidgetMapper::ManualSubmit );

this->GBTitulo->setTitle( "Modificar proveedor" );

testing = test;
}

#include <QSqlError>
Expand Down Expand Up @@ -59,7 +61,7 @@ bool FormModificarProveedor::guardar()
}
}
if( mapa->submit() ) {
QMessageBox::information( this, "Correcto", "Datos guardados correctamente" );
if( !testing ) { QMessageBox::information( this, "Correcto", "Datos guardados correctamente" ); }
this->close();
return true;
} else {
Expand Down
3 changes: 2 additions & 1 deletion plugins/proveedor/formmodificarproveedor.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FormModificarProveedor : public EVentana, public Ui::FormProveedorBase
{
Q_OBJECT
public:
explicit FormModificarProveedor( MProveedor *m, QWidget *parent = 0);
explicit FormModificarProveedor( MProveedor *m, QWidget *parent = 0, bool testing = false );
void setearItem( const int id );

public slots:
Expand All @@ -25,6 +25,7 @@ public slots:
private:
QDataWidgetMapper *mapa;
MProveedor *modelo;
bool testing;

};

Expand Down
7 changes: 4 additions & 3 deletions test/ProveedorTest/tst_proveedortest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ void ProveedorTest::testVentanaModificar()

MProveedor *mp = new MProveedor();
mp->select();
FormModificarProveedor *fmp = new FormModificarProveedor( mp );
fmp->setearItem( id_proveedor );

FormModificarProveedor *fmp = new FormModificarProveedor( mp, 0, true );
fmp->setearItem( 0 );
fmp->LERazonSocial->setText( nombre );
fmp->TEDireccion->setPlainText( direccion );
fmp->LEFax->setText( fax );
Expand All @@ -94,7 +95,7 @@ void ProveedorTest::testVentanaModificar()
QCOMPARE( cola.record().value(3).toString(), telefono );
QCOMPARE( cola.record().value(4).toString(), email );
QCOMPARE( cola.record().value(5).toString(), celular );
QCOMPARE( cola.record().value(6).toString(), cuit_cuil );
QCOMPARE( cola.record().value(6).toString().replace( '-', "" ), cuit_cuil );
}

void ProveedorTest::testVentanaModificar_data()
Expand Down

0 comments on commit 5f66041

Please sign in to comment.