<commit_before>@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>



@implementation CPTabView (TEST)

- (CPSegmentedControl)tabs
{
    return _tabs;
}

- (CPBox)box
{
    return _box;
}

@end


@implementation CPTabViewTest : OJTestCase
{
    CPTabView       _tableView;
    CPTabViewItem   _tabItem1;
    CPTabViewItem   _tabItem2;
}

- (void)setUp
{
    _tabView = [[CPTabView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)];
    
    _tabItem1 = [[CPTabViewItem alloc] initWithIdentifier:@"id1"];    
    [_tabItem1 setLabel:@"Item A"];
    [_tabItem1 setView:[[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]]

    _tabItem2 = [[CPTabViewItem alloc] initWithIdentifier:@"id2"];
    [_tabItem2 setLabel:@"Item B"];
    [_tabItem2 setView:[[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]]
    
    [_tabView addTabViewItem:_tabItem1];
    [_tabView addTabViewItem:_tabItem2];
}

- (void)testCreate
{
    [self assertNotNull:_tabView];
    
}

- (void)testMiddle
{
    var tabs = [_tabView tabs];
    [self assert:([_tabView frameSize].width / 2)  equals:CPRectGetMidX([tabs frame])];
}

- (void)testMiddleAfterMoveFrame
{
    var tabs = [_tabView tabs];
    [_tabView setFrame:CPRectMake(10, 100, 1000, 200)];
    [self assert:([_tabView frameSize].width / 2)  equals:CPRectGetMidX([tabs frame])];
}

- (void)testMiddleAfterMoveBound
{
    var tabs = [_tabView tabs];
    [_tabView setBounds:CPRectMake(100, 100, 20, 300)];
    [self assert:([tabs boundsSize].width / 2)  equals:CPRectGetMidX([tabs bounds])];
}

- (void)testBoxHeight
{
    var box = [_tabView box],
        tabs = [_tabView tabs];
    
    [_tabView setFrame:CPRectMake(0, 0, 800, 800)];
    [self assert:[box frameSize].height  equals:800 - [tabs frameSize].height / 2];
}


@end<commit_msg>Tests for Pull Request 1085<commit_after>@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>



@implementation CPTabView (TEST)

- (CPSegmentedControl)tabs
{
    return _tabs;
}

- (CPBox)box
{
    return _box;
}

@end


@implementation CPTabViewTest : OJTestCase
{
    CPTabView       _tableView;
    CPTabViewItem   _tabItem1;
    CPTabViewItem   _tabItem2;
}

- (void)setUp
{
    _tabView = [[CPTabView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)];
    
    _tabItem1 = [[CPTabViewItem alloc] initWithIdentifier:@"id1"];    
    [_tabItem1 setLabel:@"Item A"];
    [_tabItem1 setView:[[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]]

    _tabItem2 = [[CPTabViewItem alloc] initWithIdentifier:@"id2"];
    [_tabItem2 setLabel:@"Item B"];
    [_tabItem2 setView:[[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]]
    
    [_tabView addTabViewItem:_tabItem1];
    [_tabView addTabViewItem:_tabItem2];
}

- (void)testCreate
{
    [self assertNotNull:_tabView];
    
}

- (void)testMiddle
{
    var tabs = [_tabView tabs];
    [self assert:([_tabView frameSize].width / 2)  equals:CPRectGetMidX([tabs frame])];
}

- (void)testMiddleAfterMoveFrame
{
    var tabs = [_tabView tabs];
    [_tabView setFrame:CPRectMake(10, 100, 1000, 200)];
    [self assert:([_tabView frameSize].width / 2)  equals:CPRectGetMidX([tabs frame])];
}

- (void)testMiddleAfterMoveBound
{
    var tabs = [_tabView tabs];
    [_tabView setBounds:CPRectMake(100, 100, 20, 300)];
    [self assert:([tabs boundsSize].width / 2)  equals:CPRectGetMidX([tabs bounds])];
}

- (void)testBoxHeight
{
    var box = [_tabView box],
        tabs = [_tabView tabs];
    
    [_tabView setFrame:CPRectMake(0, 0, 800, 800)];
    [self assert:[box frameSize].height  equals:800 - [tabs frameSize].height / 2];
}

- (void)testTabViewGetsSetOnViewItem
{
    [self assert:[_tabItem1 tabView] equals:_tabView];
}

- (void)testTabViewGetsRemoveOnViewItem
{
    [_tabView removeTabViewItem:_tabItem1];
    [self assertNull:[_tabItem1 tabView]];
}

@end
{'fraction_non_alphanumeric': 0.14102564102564102, 'fraction_numerical': 0.04055468341182627, 'mean_word_length': 4.077025232403718, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6316345', 'n_tokens_mistral': 1586, 'n_tokens_neox': 1375, 'n_words': 274}