Exemple #1
0
    static string TestTypeString(ViewTestType type)
    {
        switch (type)
        {
        case ViewTestType.TEST_TYPE_COLOR:               return("COLOR");

        case ViewTestType.TEST_TYPE_IMAGE:               return("IMAGE");

        case ViewTestType.TEST_TYPE_TEXT:                return("TEXT");

        case ViewTestType.TEST_TYPE_ROUNDED_COLOR:       return("ROUNDED COLOR");

        #if ALLOW_BORDER_AND_BLUR
        case ViewTestType.TEST_TYPE_BORDER_COLOR:        return("BORDER COLOR");

        case ViewTestType.TEST_TYPE_ROUNDED_BORDER_COLOR: return("ROUNDED BORDER COLOR");

        case ViewTestType.TEST_TYPE_BLUR_COLOR:          return("BLUR COLOR");

        case ViewTestType.TEST_TYPE_ROUNDED_BLUR_COLOR:  return("ROUNDED BLUR COLOR");
        #endif
        default:                                         return("UNKNOWN");
        }
    }
Exemple #2
0
    bool OnTick(object o, EventArgs e)
    {
        tickCount++;
        if (tickCount < mTotalColumnsCount * (int)ViewTestType.TEST_TYPE_MAX)
        {
            // Start next phase.
            Timer timer = new Timer(mDurationPerColumns);
            timer.Tick += OnTick;
            mTimerList.AddLast(timer);

            timer.Start();
        }
        DateTime startTime;
        DateTime endTime;

        startTime = DateTime.Now;

        View columnView = new View()
        {
            BackgroundColor = Color.Blue,
            Size            = new Size(mSize.X, mWindowSize.Y),
            Position        = new Position(mWindowSize.X, 0.0f),
        };

        for (int i = 0; i < mRowsCount; ++i)
        {
            View bgView;
            switch (mTestType)
            {
            case ViewTestType.TEST_TYPE_COLOR:
            default:
            {
                bgView = CreateColor();
                break;
            }

            case ViewTestType.TEST_TYPE_IMAGE:
            {
                bgView = CreateImage();
                break;
            }

            case ViewTestType.TEST_TYPE_TEXT:
            {
                bgView = CreateTextLabel();
                break;
            }

            case ViewTestType.TEST_TYPE_ROUNDED_COLOR:
            {
                bgView = CreateRoundedColor();
                break;
            }

#if ALLOW_BORDER_AND_BLUR
            case ViewTestType.TEST_TYPE_BORDER_COLOR:
            {
                bgView = CreateBorderColor(Math.Min(mSize.X, mSize.Y) * VIEW_MARGIN_RATE);
                break;
            }

            case ViewTestType.TEST_TYPE_ROUNDED_BORDER_COLOR:
            {
                bgView = CreateRoundedBorderColor(Math.Min(mSize.X, mSize.Y) * VIEW_MARGIN_RATE);
                break;
            }

            case ViewTestType.TEST_TYPE_BLUR_COLOR:
            {
                bgView = CreateBlurColor(Math.Min(mSize.X, mSize.Y) * VIEW_MARGIN_RATE * 0.5f);
                break;
            }

            case ViewTestType.TEST_TYPE_ROUNDED_BLUR_COLOR:
            {
                bgView = CreateRoundedBlurColor(Math.Min(mSize.X, mSize.Y) * VIEW_MARGIN_RATE * 0.5f);
                break;
            }
#endif
            }
            bgView.Size     = new Size(mSize.X * (1.0f - VIEW_MARGIN_RATE), mSize.Y * (1.0f - VIEW_MARGIN_RATE));
            bgView.Position = new Position(mSize.X * VIEW_MARGIN_RATE * 0.5f, (mSize.Y * VIEW_MARGIN_RATE * 0.5f) + (mSize.Y * (float)i));
            columnView.Add(bgView);
        }

        mWindow.Add(columnView);
        mViewList.AddLast(columnView);

        // Add move animation
        Animation animation = new Animation((int)(mDurationPerColumns * (mColumnsCount + 1)));
        animation.AnimateTo(columnView, "PositionX", -mSize.X);
        animation.Finished += OnAnimationFinished;
        animation.Play();

        mAnimationList.AddLast(animation);

        endTime = DateTime.Now;

        mCreationStatistic.add((endTime - startTime).TotalMilliseconds);

        if (tickCount % mTotalColumnsCount == 0)
        {
            Tizen.Log.Error("NUI.PerfNew", $"Average of creation {mRowsCount} NUI({TestTypeString(mTestType)}) : {mCreationStatistic.getTrimedAverage()} ms\n");
            mCreationStatistic.clear();
            mTestType = (ViewTestType)(((int)(mTestType) + 1) % (int)(ViewTestType.TEST_TYPE_MAX));
        }

        return(false);
    }