1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#include "TestCases.hxx"
#include "SimpleProcessing.hxx"
#include "ControlAdapter.hxx"
#include "FakeControlWidget.hxx"
namespace CLAMDraft
{
using CLAMVM::ControlAdapter;
void TestBindingProcessingAdapter()
{
SimpleProcessing proc;
SimpleProcessingConfig procCfg;
ControlAdapter adap;
proc.Configure( procCfg );
CLAM_ASSERT( adap.BindTo( proc.GetControl() ), "Binding Failed" );
}
void TestAttachPresentationAdapter()
{
ControlAdapter adap;
FakeControlWidget fakeWidget;
fakeWidget.AttachTo( adap );
}
void TestControlUpdating()
{
SimpleProcessing proc;
SimpleProcessingConfig procCfg;
ControlAdapter adap;
FakeControlWidget fakeWidget;
proc.Configure( procCfg );
adap.BindTo( proc.GetControl() );
adap.Publish();
fakeWidget.AttachTo( adap );
fakeWidget.SendValue.Emit( 10 );
adap.Update();
CLAM_ASSERT( proc.GetControl().GetLastValue() == 10 ,
"Value was not received by model object" );
}
void TestSeveralControlsUpdating()
{
SimpleProcessing proc;
SimpleProcessingConfig procCfg;
ControlAdapter adap;
FakeControlWidget fakeWidget;
proc.Configure( procCfg );
adap.BindTo( proc.GetControl() );
fakeWidget.AttachTo( adap );
for ( int i = 0; i < 11; i++ )
{
fakeWidget.SendValue.Emit( i );
}
adap.Update();
CLAM_ASSERT( proc.GetControl().GetLastValue() == 10 ,
"Value was not received by model object" );
}
}
|