lundi 6 avril 2015

how to get the uibutton state value in test.m file

in .m file i have methods like



-(void) textdata
{
long i = search.text.length;

if (i > 0) {
searchButton.enabled = YES;
}

else
{
searchButton.enabled = NO;

}


[self buttonstate];


}

-(int) buttonstate {



if ([searchButton isEnabled]) {
j = 1;


}

else

j = 0;


NSLog(@" j value is %d",j);

return j;
}


- (void) textFieldDidChange {

[self textdata];


NSLog(@"test data is %@",search.text);
}


and in the tests.m file i have test like



-(void) testwithoutData {
myapiViewController *apiViw = [[myapiViewController alloc]init];

[apiViw textdata];

int kn = [apiViw buttonstate];

NSLog(@"the value is %ld",(long)kn);


}

Aucun commentaire:

Enregistrer un commentaire