ios - Running Unit Tests which creates UIKit objects causes breakpoint -
when creating uilabel while running unit tests, causes exc_breakpoint (code=exc_i386_bpt, subcode 0x0)
what doing wrong?
- (void)setlabelcount:(nsuinteger)labelcount { _labelcount = labelcount; nsmutablearray *labels = [[nsmutablearray alloc] init]; (int idx=0; idx<self.labelcount; idx++) { uilabel *lbl = [[uilabel alloc] initwithframe:cgrectzero]; // <--- lbl.backgroundcolor = [uicolor clearcolor]; [labels addobject:lbl]; [self.dataview addsubview:lbl]; } self.labels = labels; [self updatecontents]; }
here unit test calls code
- (void)setup { cell = [[ldpchartcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"chartcell"]; cell.labelcount = 10; // <--- } - (void)teardown { cell = nil; } - (void)testthatreuseidentifierisset { stassertequalobjects(cell.reuseidentifier, @"chartcell", @""); }
Comments
Post a Comment