Пример #1
0
def rqtest_9():
    layer = pmstestlib.layer
    
    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult( i )
        if result is None:
            break
    
        count = count + 1

    if count != 100:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 100) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.
    
    result = layer.getResult( 0 )
    s = layer.getShape( result )
    
    if pmstestlib.check_items( layer, s,
                               [('value_0','148'),
                                ('red','148'),
                                ('green','148'),
                                ('blue','148'),
                                ('value_list','148'),
                                ('x','35.5'),
                                ('y','34.5')] ) == 0:
        return 'fail'
    
    #########################################################################
    # Check last shape attributes.

    result = layer.getResult( 99 )
    s = layer.getShape( result )

    if pmstestlib.check_items( layer, s,
                               [('value_0','132'),
                                ('red','132'),
                                ('green','132'),
                                ('blue','132'),
                                ('value_list','132'),
                                ('x','44.5'),
                                ('y','25.5')] ) == 0:
        return 'fail'
    
    layer.close() 
    layer.close() # discard resultset.

    return 'success'
Пример #2
0
def rqtest_13():
    layer = pmstestlib.layer

    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult(i)
        if result is None:
            break

        count = count + 1

    if count != 1:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 1) )
        return 'fail'

    result = layer.getResult(0)
    s = layer.getShape(result)

    if pmstestlib.check_items(layer, s, [('value_0', '1'), ('red', '255'),
                                         ('green', '0'), ('blue', '0'),
                                         ('class', 'Grid'), ('x', '13.5'),
                                         ('y', '36.5')]) == 0:
        return 'fail'

    layer.close()
    layer.close()  # discard resultset.

    return 'success'
Пример #3
0
def rqtest_7():
    layer = pmstestlib.layer

    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult(i)
        if result is None:
            break

        count = count + 1

    if count != 1:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 1) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.

    result = layer.getResult(0)
    s = layer.getShape(result)

    if pmstestlib.check_items(layer, s, [('value_0', '115'), ('x', '35.5'),
                                         ('y', '25.5')]) == 0:
        return 'fail'

    layer.close()
    layer.close()  # discard resultset.

    return 'success'
Пример #4
0
def rqtest_5():
    layer = pmstestlib.layer
    
    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult( i )
        if result is None:
            break
    
        count = count + 1

    if count != 9:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 9) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.
    
    result = layer.getResult( 0 )
    s = layer.getShape( result )
    
    if pmstestlib.check_items( layer, s,
                               [('value_0','123'),
                                ('x','34.5'),
                                ('y','26.5')] ) == 0:
        return 'fail'
    
    #########################################################################
    # Check last shape attributes.

    result = layer.getResult( 8 )
    s = layer.getShape( result )

    if pmstestlib.check_items( layer, s,
                               [('value_0','107'),
                                ('x','36.5'),
                                ('y','24.5')] ) == 0:
        return 'fail'
    
    layer.close() 
    layer.close() # discard resultset.

    return 'success'
Пример #5
0
def ogr_query_6():

    return 'skip'

    layer = pmstestlib.layer

    layer.open()

    #########################################################################
    # Check first shape attributes.

    result = layer.getResult(0)

    s = mapscript.shapeObj(mapscript.MS_SHAPE_POLYGON)
    layer.resultsGetShape(s, 9, 0)

    if pmstestlib.check_items(layer, s, [('EAS_ID', '        170')]) == 0:
        return 'fail'

    layer.close()
    layer.close()  # discard resultset.

    return 'success'
Пример #6
0
def ogr_query_7():
    map = pmstestlib.map

    map.draw()
    layer = pmstestlib.layer
    
    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult( i )
        if result is None:
            break
    
        count = count + 1

    if count != 2:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 55) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.
    
    result = layer.getResult( 0 )
    
    s = layer.getShape( result )
    
    if pmstestlib.check_items( layer, s,
                               [('EAS_ID','        168')] ) == 0:
        return 'fail'

    layer.close() 
    layer.close() # discard resultset.

    return 'success'
Пример #7
0
def ogr_query_7():
    map = pmstestlib.map

    map.draw()
    layer = pmstestlib.layer

    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult(i)
        if result is None:
            break

        count = count + 1

    if count != 2:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 55) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.

    result = layer.getResult(0)

    s = layer.getShape(result)

    if pmstestlib.check_items(layer, s, [('EAS_ID', '        168')]) == 0:
        return 'fail'

    layer.close()
    layer.close()  # discard resultset.

    return 'success'
Пример #8
0
def ogr_query_6():

    return 'skip'

    layer = pmstestlib.layer
    
    layer.open()
    
    #########################################################################
    # Check first shape attributes.
    
    result = layer.getResult( 0 )
    
    s = mapscript.shapeObj( mapscript.MS_SHAPE_POLYGON )
    layer.resultsGetShape( s, 9, 0 )
    
    if pmstestlib.check_items( layer, s,
                               [('EAS_ID','        170')] ) == 0:
        return 'fail'

    layer.close() 
    layer.close() # discard resultset.

    return 'success'
Пример #9
0
def rqtest_13():
    layer = pmstestlib.layer
    
    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult( i )
        if result is None:
            break
    
        count = count + 1

    if count != 1:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 1) )
        return 'fail'

    result = layer.getResult( 0 )
    s = layer.getShape( result )
    
    if pmstestlib.check_items( layer, s,
                               [('value_0','1'),
                                ('red','255'),
                                ('green','0'),
                                ('blue','0'),
                                ('class','Grid'),
                                ('x','13.5'),
                                ('y','36.5')] ) == 0:
        return 'fail'
    
    layer.close() 
    layer.close() # discard resultset.

    return 'success'
Пример #10
0
def ogr_query_3():
    layer = pmstestlib.layer

    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult(i)
        if result is None:
            break

        s = layer.getShape(result)
        count = count + 1

    if count != 2:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 55) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.

    result = layer.getResult(0)

    s = layer.getShape(result)

    if pmstestlib.check_items(layer, s, [('EAS_ID', '        158')]) == 0:
        return 'fail'

    #########################################################################
    # Check first shape geometry.

    if s.type != mapscript.MS_SHAPE_POLYGON:
        pmstestlib.post_reason('query result is not a polygon.')
        return 'fail'

    if s.numlines != 1:
        pmstestlib.post_reason('query has other than 1 lines.')
        return 'fail'

    try:
        l = s.getLine(0)
    except:
        l = s.get(0)
    if l.numpoints != 61:
        pmstestlib.post_reason(
            'query has %d points, instead of expected number.' % l.numpoints)
        return 'fail'

    try:
        p = l.getPoint(0)
    except:
        p = l.get(5)

    if abs(p.x - 480984.25) > 0.01 or abs(p.y - 4764875.0) > 0.01:
        print p.x, p.y
        pmstestlib.post_reason('got wrong location.')
        return 'fail'

    #########################################################################
    # Check last shape attributes.

    result = layer.getResult(1)

    s = layer.getShape(result)

    if pmstestlib.check_items(layer, s, [('EAS_ID', '        165')]) == 0:
        return 'fail'

    layer.close()
    layer.close()  # discard resultset.

    return 'success'
Пример #11
0
def ogr_query_3():
    layer = pmstestlib.layer
    
    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult( i )
        if result is None:
            break

        s = layer.getShape( result )
        count = count + 1

    if count != 2:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 55) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.
    
    result = layer.getResult( 0 )
    
    s = layer.getShape( result )
    
    if pmstestlib.check_items( layer, s,
                               [('EAS_ID','        158')] ) == 0:
        return 'fail'

    #########################################################################
    # Check first shape geometry.

    if s.type != mapscript.MS_SHAPE_POLYGON:
        pmstestlib.post_reason( 'query result is not a polygon.' )
        return 'fail'

    if s.numlines != 1:
        pmstestlib.post_reason( 'query has other than 1 lines.' )
        return 'fail'

    try:
        l = s.getLine( 0 )
    except:
        l = s.get( 0 )
    if l.numpoints != 61:
        pmstestlib.post_reason( 'query has %d points, instead of expected number.' % l.numpoints )
        return 'fail'

    try:
        p = l.getPoint(0)
    except:
        p = l.get(5)

    if abs(p.x-480984.25) > 0.01 or abs(p.y-4764875.0) > 0.01:
        print p.x, p.y
        pmstestlib.post_reason( 'got wrong location.' )
        return 'fail'
    
    #########################################################################
    # Check last shape attributes.

    result = layer.getResult( 1 )
    
    s = layer.getShape( result )

    if pmstestlib.check_items( layer, s,
                               [('EAS_ID','        165')] ) == 0:
        return 'fail'
    
    layer.close() 
    layer.close() # discard resultset.

    return 'success'
Пример #12
0
def rqtest_3():
    layer = pmstestlib.layer

    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult(i)
        if result is None:
            break

        count = count + 1

    if count != 55:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 55) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.

    result = layer.getResult(0)
    s = layer.getShape(result)

    if pmstestlib.check_items(layer, s, [('value_0', '115'), ('red', '115'),
                                         ('green', '115'), ('blue', '115'),
                                         ('value_list', '115'), ('x', '39.5'),
                                         ('y', '29.5')]) == 0:
        return 'fail'

    #########################################################################
    # Check first shape geometry.
    if s.type != mapscript.MS_SHAPE_POINT:
        pmstestlib.post_reason('raster query result is not a point.')
        return 'fail'

    if s.numlines != 1:
        pmstestlib.post_reason('raster query has other than 1 lines.')
        return 'fail'

    try:
        l = s.getLine(0)
    except:
        l = s.get(0)
    if l.numpoints != 1:
        pmstestlib.post_reason('raster query has other than 1 points.')
        return 'fail'

    try:
        p = l.getPoint(0)
    except:
        p = l.get(0)
    if p.x != 39.5 or p.y != 29.5:
        pmstestlib.post_reason('got wrong point location.')
        return 'fail'

    #########################################################################
    # Check last shape attributes.

    result = layer.getResult(54)
    s = layer.getShape(result)

    if pmstestlib.check_items(layer, s, [('value_0', '132'), ('x', '44.5'),
                                         ('y', '25.5')]) == 0:
        return 'fail'

    layer.close()
    layer.close()  # discard resultset.

    return 'success'
Пример #13
0
def rqtest_3():
    layer = pmstestlib.layer
    
    #########################################################################
    # Check result count.
    layer.open()
    count = 0
    for i in range(1000):
        result = layer.getResult( i )
        if result is None:
            break
    
        count = count + 1

    if count != 55:
        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
                             % (count, 55) )
        return 'fail'

    #########################################################################
    # Check first shape attributes.
    
    result = layer.getResult( 0 )
    s = layer.getShape( result )
    
    if pmstestlib.check_items( layer, s,
                               [('value_0','115'),
                                ('red','115'),
                                ('green','115'),
                                ('blue','115'),
                                ('value_list','115'),
                                ('x','39.5'),
                                ('y','29.5')] ) == 0:
        return 'fail'

    #########################################################################
    # Check first shape geometry.
    if s.type != mapscript.MS_SHAPE_POINT:
        pmstestlib.post_reason( 'raster query result is not a point.' )
        return 'fail'

    if s.numlines != 1:
        pmstestlib.post_reason( 'raster query has other than 1 lines.' )
        return 'fail'

    try:
        l = s.getLine( 0 )
    except:
        l = s.get( 0 )
    if l.numpoints != 1:
        pmstestlib.post_reason( 'raster query has other than 1 points.' )
        return 'fail'

    try:
        p = l.getPoint(0)
    except:
        p = l.get(0)
    if p.x != 39.5 or p.y != 29.5:
        pmstestlib.post_reason( 'got wrong point location.' )
        return 'fail'
    
    #########################################################################
    # Check last shape attributes.

    result = layer.getResult( 54 )
    s = layer.getShape( result )

    if pmstestlib.check_items( layer, s,
                               [('value_0','132'),
                                ('x','44.5'),
                                ('y','25.5')] ) == 0:
        return 'fail'
    
    layer.close() 
    layer.close() # discard resultset.

    return 'success'