Conjunto de mudanças 6586 no repositório publico


Ignorar:
Timestamp:
29/06/2012 20:26:01 (9 anos atrás)
Autor:
mazza
Mensagem:

teste: paineis de carrosseis diferentes sao independentes

Localização:
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis
Arquivos:
2 editados

Legenda:

Não Modificado
Adicionado
Removido
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/boxes/carousel.py

    r6585 r6586  
    3939        panels = self.panels
    4040        for i in range(NUMBER_OF_PRE_CREATED_BOXES):
    41             if i not in panels and Box(ICarouselItem, number).is_empty(self.context):
     41            if i not in panels and Box(ICarouselItem, i).is_empty(self.context):
    4242                panels.insert(0, i)
     43                # this marks the slot as used
     44                # to avoid conflicts between panels of two carousels
     45                Box(ICarouselItem, i).get_data(self.context)
    4346                break
    4447
  • PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/tests/testunitcarousel.py

    r6585 r6586  
    6565'''.strip('\n'), Carousel(0, context).render())
    6666            IAnnotations.assert_called_with(context)
     67
     68    def test_multiple_carousel_panels_are_independant(self):
     69        """Make sure the panels of different carousels do not mix
     70        with one another after edit operations.
     71        """
     72        annotations = {}
     73        context = object()
     74        with patch('il.portalinterlegis.browser.boxes.manager.IAnnotations') as IAnnotations:
     75            IAnnotations.return_value = annotations
     76            carousel_0 = Carousel(0, context)
     77            carousel_1 = Carousel(1, context)
     78
     79            carousel_0.add_item()
     80            carousel_0.add_item()
     81            carousel_0.add_item()
     82            self.assertEqual(carousel_0.panels, [2, 1, 0])
     83            self.assertEqual(carousel_1.panels, [])
     84            carousel_0.remove_item('zzzzz_1')
     85            self.assertEqual(carousel_0.panels, [2, 0])
     86            self.assertEqual(carousel_1.panels, [])
     87            carousel_1.add_item()
     88            carousel_1.add_item()
     89            self.assertEqual(carousel_0.panels, [2, 0])
     90            self.assertEqual(carousel_1.panels, [3, 1])
     91            carousel_1.remove_item('zzzzz_3')
     92            self.assertEqual(carousel_0.panels, [2, 0])
     93            self.assertEqual(carousel_1.panels, [1])
     94            carousel_0.add_item()
     95            carousel_0.add_item()
     96            carousel_1.add_item()
     97            self.assertEqual(carousel_0.panels, [4, 3, 2, 0])
     98            self.assertEqual(carousel_1.panels, [5, 1])
Note: Veja TracChangeset para ajuda no uso do visualizador de conjunto de mudanças.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.