../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
../dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp
../dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_TEST_EQUALS( naturalSize, Vector2( 80.f, 20.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
const float height = textVisual.GetHeightForWidth( 40.f );
- DALI_TEST_EQUALS( height, 40.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( height, 38.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Test that NPatchVisual is replaced with debug visual
// TEST_NPATCH_FILE_NAME: image_01.9.jpg
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// single line, line spacing = 0px
{
const float EXPECTED_SPACING = 0.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 326.0f, 19.0f);
- const Vector3 EXPECTED_NATURAL_SIZE( 326.0f, 20.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 343.0f, 19.0f);
+ const Vector3 EXPECTED_NATURAL_SIZE( 344.0f, 20.0f, 0.0f );
controller->SetText(textSingle);
controller->Relayout(size);
// single line, line spacing = 20px
{
const float EXPECTED_SPACING = 20.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 326.0f, 19.0f );
- const Vector3 EXPECTED_NATURAL_SIZE( 326.0f, 40.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 343.0f, 19.0f );
+ const Vector3 EXPECTED_NATURAL_SIZE( 344.0f, 40.0f, 0.0f );
controller->SetText(textSingle);
controller->Relayout(size);
// multi-line, line spacing = 0px
{
const float EXPECTED_SPACING = 0.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 318.0f, 39.0f );
- const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 58.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 333.0f, 39.0f );
+ const Vector3 EXPECTED_NATURAL_SIZE( 120.0f, 58.0f, 0.0f );
controller->SetText(textMulti);
controller->Relayout(size);
// multi-line, line spacing = 20px
{
const float EXPECTED_SPACING = 20.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 115.0f, 57.0f );
- const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 118.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 119.0f, 57.0f );
+ const Vector3 EXPECTED_NATURAL_SIZE( 120.0f, 118.0f, 0.0f );
controller->SetText(textMulti);
controller->Relayout(size);
// multi-line, line spacing = 30px
{
const float EXPECTED_SPACING = 30.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 115.0f, 117.0f );
- const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 148.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 119.0f, 117.0f );
+ const Vector3 EXPECTED_NATURAL_SIZE( 120.0f, 148.0f, 0.0f );
controller->SetText(textMulti);
controller->Relayout(size);
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun );
Size textArea(1.f, 1.f);
- Size layoutSize(80.f, 20.f);
+ Size layoutSize(80.f, 19.f);
float positions[] = { 1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f };
struct LineRun line =
{
{ 0u, 11u },
80.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun1 );
fontDescriptionRuns.PushBack( fontDescriptionRun2 );
Size textArea(100.f, 300.f);
- Size layoutSize(95.f, 97.f);
+ Size layoutSize(95.f, 95.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 6u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun4 );
fontDescriptionRuns.PushBack( fontDescriptionRun5 );
Size textArea(100.f, 300.f);
- Size layoutSize(80.f, 120.f);
+ Size layoutSize(80.f, 114.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 22u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 28u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 38u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 50u, 5u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun );
Size textArea(100.f, 300.f);
- Size layoutSize(96.f, 60.f);
+ Size layoutSize(96.f, 57.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -9.f, 47.f, -9.f, 57.f, -9.f, 63.f, -13.f, 66.f, -13.f, 75.f, -13.f, 84.f, -9.f,
{ 0u, 12u },
93.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 12u, 12u },
96.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 24u, 5u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun );
Size textArea(100.f, 300.f);
- Size layoutSize(83.f, 40.f);
+ Size layoutSize(83.f, 38.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -2.f, 82.f, -12.f
{ 0u, 13u },
83.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
false,
{ 13u, 0u },
0.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun2 );
fontDescriptionRuns.PushBack( fontDescriptionRun3 );
Size textArea(100.f, 300.f);
- Size layoutSize(88.f, 53.f);
+ Size layoutSize(89.f, 51.f);
float positions[] =
{
- 1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -14.f, 59.f, -9.f, 69.f, -9.f, 75.f, -13.f, 78.f, -13.f, 87.f, -0.f,
+ 1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -14.f, 60.f, -9.f, 70.f, -9.f, 76.f, -13.f, 79.f, -13.f, 88.f, -0.f,
0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -2.f
};
struct LineRun line0 =
{
{ 0u, 12u },
{ 0u, 12u },
- 88.f,
+ 89.f,
25.f,
- -8.f,
+ -7.f,
4.f,
0.f,
0.f,
{ 12u, 5u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun16 );
fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
- Size layoutSize(92.f, 380.f);
+ Size layoutSize(92.f, 361.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 22u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 28u, 20u },
92.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 48u, 11u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 59u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 64u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 74u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
1.f,
0.f,
{ 86u, 6u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 92u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 104u, 19u },
90.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 123u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 128u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 140u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 150u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 156u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 166u, 12u },
79.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 178u, 14u },
55.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 192u, 0u },
0.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun16 );
fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
- Size layoutSize(92.f, 380.f);
+ Size layoutSize(92.f, 361.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 22u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 28u, 20u },
92.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 48u, 11u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 59u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 64u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 74u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
1.f,
0.f,
{ 86u, 6u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 92u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 104u, 19u },
90.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 123u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 128u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 140u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 150u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 156u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 166u, 12u },
79.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 178u, 14u },
55.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 192u, 0u },
0.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun16 );
fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
- Size layoutSize(92.f, 380.f);
+ Size layoutSize(92.f, 361.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 22u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 28u, 20u },
92.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 48u, 11u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 59u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 64u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 74u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
1.f,
0.f,
{ 86u, 6u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 92u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 104u, 19u },
90.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 123u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 128u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 140u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 150u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 156u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 166u, 12u },
79.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 178u, 14u },
55.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 192u, 0u },
0.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 0u, 13u },
93.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 20.f );
+ Size layoutSize( 100.f, 19.f );
LayoutTextData data =
{
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 12u },
93.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 40.f );
+ Size layoutSize( 100.f, 38.f );
LayoutTextData data =
{
{ 0u, 16u },
95.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 20.f );
+ Size layoutSize( 100.f, 19.f );
LayoutTextData data =
{
{ 0u, 16u },
96.f,
15.f,
- -5.f,
+ -4.f,
3.f,
0.f,
0.f,
{ 16u, 18u },
97.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 40.f );
+ Size layoutSize( 100.f, 38.f );
LayoutTextData data =
{
{ 0u, 11u },
80.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
false,
- true
+ false
};
Vector<LineRun> lines;
lines.PushBack( line01 );
};
Size textArea( 100.f, 19.f );
- Size layoutSize( 100.f, 20.f );
+ Size layoutSize( 80.f, 19.f );
LayoutTextData data =
{
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct GlyphInfoData glyphs04[] =
{
- { 2u, 160u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 123u, 0.f, 0.f, 0.f, 0.f, 9.f, 0.f },
- { 2u, 153u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 160u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 150u, 0.f, 0.f, 0.f, 0.f, 14.f, 0.f },
- { 2u, 153u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 160u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 151u, 0.f, 0.f, 0.f, 0.f, 12.f, 0.f },
- { 2u, 153u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 160u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 147u, 0.f, 0.f, 0.f, 0.f, 9.f, 0.f },
- { 2u, 153u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
+ { 2u, 1733u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1693u, 0.f, 0.f, 0.f, 0.f, 13.f, 0.f },
+ { 2u, 1725u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1733u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1721u, 0.f, 0.f, 0.f, 0.f, 20.f, 0.f },
+ { 2u, 1725u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1733u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1722u, 0.f, 0.f, 0.f, 0.f, 18.f, 0.f },
+ { 2u, 1725u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1733u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1718u, 0.f, 0.f, 0.f, 0.f, 14.f, 0.f },
+ { 2u, 1725u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
};
CharacterIndex characterIndices04[] = { 0u, 0u, 0u, 2u, 2u, 2u, 4u, 4u, 4u, 6u, 6u, 6u };
{ 1u, 3u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
{ 1u, 71u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f },
{ 1u, 72u, 0.f, 0.f, 0.f, 0.f, 9.f, 0.f },
- { 1u, 5034u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f },
+ { 1u, 5039u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f },
{ 1u, 81u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f },
{ 1u, 76u, 0.f, 0.f, 0.f, 0.f, 4.f, 0.f },
{ 1u, 72u, 0.f, 0.f, 0.f, 0.f, 9.f, 0.f },
struct GlyphInfoData glyphs01[] =
{
- { 2u, 14750u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, true, true },
- { 2u, 9802u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, true, true },
- { 2u, 12811u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, true, true },
+ { 2u, 4857u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, true, false },
+ { 2u, 7316u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, true, false },
+ { 2u, 4364u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, true, false },
};
struct GlyphInfoData glyphs02[] =
{
- { 2u, 14750u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, false, false },
- { 2u, 9802u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, false, true },
- { 2u, 12811u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, true, false },
+ { 2u, 4857u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, false, false },
+ { 2u, 7316u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, false, false },
+ { 2u, 4364u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, true, false },
};
CharacterIndex characterIndices[] = { 0u, 1u, 2u };
tet_result(TET_PASS);
END_TEST;
-}
\ No newline at end of file
+}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
"Aliquip sanctůs delicáta quí ěá, et natum aliquam est?\n"
"Asšúm sapěret usu ůť.\n"
"Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n";
-const Vector2 LOREM_SCROLL_POSITION( 0.f, -208.f );
-const Length LOREM_NUMBER_OF_LINES = 32u;
+const Vector2 LOREM_SCROLL_POSITION( 0.f, -265.f );
+const Length LOREM_NUMBER_OF_LINES = 35u;
const Length LOREM_NUMBER_OF_LINES_ELIDED = 21u;
const Length LOREM_NUMBER_OF_GLYPHS = 632;
-const Length LOREM_NUMBER_OF_GLYPHS_ELIDED = 397u;
+const Length LOREM_NUMBER_OF_GLYPHS_ELIDED = 395u;
// The expected layout size for UtcDaliTextViewModelGetLayoutSize
-const Size LAYOUT_SIZE( 190.f, 48.f );
+const Size LAYOUT_SIZE( 197.f, 45.f );
// The expected color indices for UtcDaliTextViewModelGetColors
const ColorIndex COLOR_INDICES[] = { 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 2u, 2u, 2u, 2u, 2u, 1u, 1u, 1u, 1u, 1u, 3u, 1u, 1u, 1u, 0u, 0u, 0u, 0u };
Size textSize00( 100.f, 100.f );
Size textSize01( 80.f, 100.f );
- float positions01[] = { 0.f, 9.f, 17.f, 27.f, 35.f, 37.f, 46.f, 56.f };
+ float positions01[] = { 0.f, 8.f, 16.f, 26.f, 33.f, 41.f, 45.f, 54.f, 64.0f };
Size textSize02( 80.f, 100.f );
- float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 11.f };
+ float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 9.0f };
Size textSize03( 80.f, 100.f );
- float positions03[] = { 77.f, 76.f, 71.f, 62.f, 59.f, 52.f, 47.f, 42.f, 39.f, 35.f, 32.f, 13.f };
+ float positions03[] = { 78.f, 73.f, 70.f, 65.f, 57.f, 55.f, 51.f, 50.f, 45.f, 35.f, 32.f, 24.f, 7.f };
Size textSize04( 80.f, 10.f );
float positions04[] = { 2.f };
"<font family='TizenSans'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>",
textSize01,
5u,
- 42u,
+ 37u,
positions01
},
{
"<font family='TizenSansArabic'>عل النفط ديسمبر الإمداد بال, بين وترك شعار هو. لمّ من المبرمة النفط بالسيطرة, أم يتم تحرّك وبغطاء, عدم في لإعادة وإقامة رجوعهم.</font>",
textSize03,
5u,
- 79u,
+ 74u,
positions03
},
{
using namespace Dali::Toolkit::Internal;
+
+void utc_dali_toolkit_texture_manager_startup(void)
+{
+ setenv( "LOG_TEXTURE_MANAGER", "3", 1 );
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_texture_manager_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
class TestObserver : public Dali::Toolkit::TextureUploadObserver
{
public:
../dali-toolkit/dali-toolkit-test-utils/toolkit-virtual-keyboard.cpp
../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
../dali-toolkit/dali-toolkit-test-utils/test-animation-data.cpp
../dali-toolkit/dali-toolkit-test-utils/test-button.cpp
../dali-toolkit/dali-toolkit-test-utils/test-application.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
../dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp
../dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp
dali-toolkit-test-utils/toolkit-web-engine.cpp
dali-toolkit-test-utils/toolkit-trigger-event-factory.cpp
dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
dali-toolkit-test-utils/dummy-control.cpp
dali-toolkit-test-utils/layout-utils.cpp
dali-toolkit-test-utils/mesh-builder.cpp
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "dali-toolkit-test-suite-utils.h"
+
+
+std::ostream& operator<<( std::ostream& ostream, Dali::Toolkit::Visual::ResourceStatus status )
+{
+ switch(status)
+ {
+ case Dali::Toolkit::Visual::ResourceStatus::PREPARING:
+ {
+ ostream << "PREPARING";
+ break;
+ }
+ case Dali::Toolkit::Visual::ResourceStatus::READY:
+ {
+ ostream << "READY";
+ break;
+ }
+ case Dali::Toolkit::Visual::ResourceStatus::FAILED:
+ {
+ ostream << "FAILED";
+ break;
+ }
+ }
+ return ostream;
+}
#define __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
+#include <iostream>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+// Put any toolkit specific operators for DALI_TEST_CHECK template here, before dali-test-suite-utils.h.
+
+std::ostream& operator<<( std::ostream& ostream, Dali::Toolkit::Visual::ResourceStatus status );
+
// INTERNAL INCLUDES
#include <dali-test-suite-utils.h>
struct timespec now;
clock_gettime( CLOCK_REALTIME, &now );
if( now.tv_nsec < 999900000 ) // 999, 900, 000
- now.tv_nsec += 100000;
+ now.tv_nsec += 1000;
else
{
now.tv_sec += 1;
Dali::CallbackBase::Execute( *callback );
triggerCount--;
}
+ if( triggerCount <= 0 )
+ {
+ break;
+ }
}
}
clock_gettime( CLOCK_REALTIME, &now );
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
Renderer renderer = imageView.GetRendererAt( 0 );
Shader shader2 = renderer.GetShader();
Property::Value value = shader2.GetProperty( Shader::Property::PROGRAM );
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
Renderer renderer = imageView.GetRendererAt( 0 );
Shader shader2 = renderer.GetShader();
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
Renderer renderer = imageView.GetRendererAt( 0 );
Shader shader2 = renderer.GetShader();
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
Renderer renderer = imageView.GetRendererAt( 0 );
Shader shader2 = renderer.GetShader();
END_TEST;
}
+
+
+namespace
+{
+static int gFailCounter = 0;
+const int MAX_RETRIES(3);
+
+void ReloadImage(ImageView imageView)
+{
+ Property::Map imageImmediateLoadingMap;
+ imageImmediateLoadingMap[ ImageVisual::Property::URL ] = "Non-existant-image.jpg";
+ imageImmediateLoadingMap[ ImageVisual::Property::LOAD_POLICY ] = ImageVisual::LoadPolicy::IMMEDIATE;
+
+ tet_infoline("Immediate load an image");
+ imageView.SetProperty( ImageView::Property::IMAGE, imageImmediateLoadingMap );
+}
+
+void ResourceFailedReload( Control control )
+{
+ gFailCounter++;
+ if( gFailCounter < MAX_RETRIES )
+ {
+ ReloadImage(ImageView::DownCast(control));
+ }
+}
+}
+
+int UtcDaliImageViewReloadFailedOnResourceReadySignal(void)
+{
+ tet_infoline("Test reloading failed image from within signal handler.");
+
+ ToolkitTestApplication application;
+
+ gFailCounter = 0;
+
+ ImageView imageView = ImageView::New();
+ imageView.ResourceReadySignal().Connect( &ResourceFailedReload );
+ DALI_TEST_EQUALS( gFailCounter, 0, TEST_LOCATION );
+ ReloadImage(imageView);
+
+ // loading started, this waits for the loader thread to complete
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( gFailCounter, 1, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( gFailCounter, 2, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+ DALI_TEST_EQUALS( gFailCounter, 3, TEST_LOCATION );
+
+ END_TEST;
+}
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <iostream>
#include <stdlib.h>
+#include <vector>
#include <dali-toolkit-test-suite-utils.h>
#include <toolkit-timer.h>
#include <toolkit-event-thread-callback.h>
namespace
{
const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
+const char* TEST_BROKEN_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/a-random-nonimage.jpg";
const char* TEST_LARGE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/tbcol.png";
const char* TEST_SMALL_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/icon-edit.png";
const char* TEST_REMOTE_IMAGE_FILE_NAME = "https://www.tizen.org/sites/all/themes/tizen_theme/logo.png";
bool gResourceReadySignalFired = false;
-
+std::vector<int> gReadyIds = {};
void ResourceReadySignal( Control control )
{
gResourceReadySignalFired = true;
+ gReadyIds.push_back(control.GetId());
+}
+void ClearReadyIds()
+{
+ gReadyIds.clear();
}
Actor CreateActorWithImageVisual(const Property::Map& map)
END_TEST;
}
+
+
+void ResourceReadyLoadNext( Control control )
+{
+ static int callNumber = 0;
+
+ gResourceReadySignalFired = true;
+ gReadyIds.push_back(control.GetId());
+
+ if( callNumber == 0 )
+ {
+ DALI_TEST_EQUALS( control.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL), Toolkit::Visual::ResourceStatus::FAILED, TEST_LOCATION );
+
+ tet_infoline( "Create visual with loaded image from within the signal handler" );
+ VisualFactory factory = VisualFactory::Get();
+ Visual::Base imageVisual = factory.CreateVisual( TEST_IMAGE_FILE_NAME, ImageDimensions{20,30} );
+
+ Impl::DummyControl& controlImpl = static_cast<Impl::DummyControl&>(control.GetImplementation());
+ controlImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual ); // This should trigger another signal.
+ callNumber = 1;
+ }
+ else
+ {
+ tet_infoline( "3rd signal called" );
+ DALI_TEST_CHECK(true);
+ }
+}
+
+int UtcDaliImageVisualLoadReady01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliImageVisualLoadReady01");
+ tet_infoline( "First part: Load an image visual for one resource, then another image visual for a second resource.");
+ tet_infoline( "Second part, In the ready signal for the second image visual, add a 3rd visual with the first URL" );
+ tet_infoline( "Should get a ready signal for all three visuals");
+
+ ClearReadyIds();
+
+ tet_infoline( "Create a control and connect to resource ready signal" );
+ DummyControl actor = DummyControl::New(true);
+ int actor1Id = actor.GetId();
+ actor.ResourceReadySignal().Connect( &ResourceReadySignal);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ actor.SetSize(200.f, 200.f);
+ Stage::GetCurrent().Add(actor);
+
+ tet_infoline( "Create visual with IMMEDIATE load policy" );
+ Visual::Base imageVisual1 = CreateVisualWithPolicy( TEST_IMAGE_FILE_NAME, ImageVisual::Property::LOAD_POLICY, ImageVisual::LoadPolicy::IMMEDIATE );
+
+ tet_infoline( "Registering visual allows control to get a signal once loaded even if visual not enabled( staged )" );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual1 );
+
+
+ tet_infoline( "Allow image time to load" );
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Testing texture is loaded and resource ready signal fired" );
+ DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gReadyIds[0], actor1Id, TEST_LOCATION );
+
+
+ tet_infoline( "Original control correctly signalled, now testing failing image" );
+
+ gResourceReadySignalFired = false; // Reset signal check ready for testing next Control
+ ClearReadyIds();
+
+ Visual::Base imageVisual2 = CreateVisualWithPolicy( TEST_BROKEN_IMAGE_FILE_NAME, ImageVisual::Property::LOAD_POLICY, ImageVisual::LoadPolicy::IMMEDIATE );
+
+ DummyControl actor2 = DummyControl::New(true);
+ int actor2Id = actor2.GetId();
+ Impl::DummyControl& dummyImpl2 = static_cast<Impl::DummyControl&>(actor2.GetImplementation());
+ actor2.ResourceReadySignal().Connect( &ResourceReadyLoadNext);
+
+ tet_infoline( "Registering visual this should trigger the ready signal when the image fails to load" );
+ dummyImpl2.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual2 );
+
+ actor2.SetSize(200.f, 200.f);
+ Stage::GetCurrent().Add(actor2);
+
+ tet_infoline( "Wait for loading thread to finish");
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gReadyIds[0], actor2Id, TEST_LOCATION);
+
+ tet_infoline( "Check for 3rd signal");
+ application.SendNotification();
+ DALI_TEST_EQUALS( gReadyIds.size(), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS( gReadyIds[1], actor2Id, TEST_LOCATION);
+
+ END_TEST;
+}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace
{
-
} // namespace
END_TEST;
}
-
-
-
if( mReleasePolicy == Toolkit::ImageVisual::ReleasePolicy::DETACHED )
{
RemoveTexture(); // If INVALID_TEXTURE_ID then removal will be attempted on atlas
+ mImpl->mResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING;
}
if( mImageUrl.IsValid() )
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#ifdef DEBUG_ENABLED
Debug::Filter* gTextureManagerLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_TEXTURE_MANAGER" );
+
+#define GET_LOAD_STATE_STRING( loadState ) \
+ loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" : \
+ loadState == TextureManager::LOADING ? "LOADING" : \
+ loadState == TextureManager::LOAD_FINISHED ? "LOAD_FINISHED" : \
+ loadState == TextureManager::WAITING_FOR_MASK ? "WAITING_FOR_MASK" : \
+ loadState == TextureManager::UPLOADED ? "UPLOADED" : \
+ loadState == TextureManager::CANCELLED ? "CANCELLED" : \
+ loadState == TextureManager::LOAD_FAILED ? "LOAD_FAILED" : "Unknown"
+
#endif
const uint32_t DEFAULT_ATLAS_SIZE( 1024u ); ///< This size can fit 8 by 8 images of average size 128 * 128
mAsyncRemoteLoaders( GetNumberOfRemoteLoaderThreads(), [&]() { return AsyncLoadingHelper(*this); } ),
mExternalTextures(),
mLifecycleObservers(),
+ mLoadQueue(),
mBrokenImageUrl(""),
- mCurrentTextureId( 0 )
+ mCurrentTextureId( 0 ),
+ mQueueLoadFlag(false)
{
}
}
TextureManager::LoadState loadState = GetTextureStateInternal( textureId );
- loadingStatus = ( loadState == TextureManager::LOADING );
-
if( loadState == TextureManager::UPLOADED )
{
// UploadComplete has already been called - keep the same texture set
textureSet = GetTextureSet( textureId );
}
+
+ // If we are loading the texture, or waiting for the ready signal handler to complete, inform
+ // caller that they need to wait.
+ loadingStatus = ( loadState == TextureManager::LOADING ||
+ loadState == TextureManager::NOT_STARTED ||
+ mQueueLoadFlag );
+
}
else
{
++( mTextureInfoContainer[ cacheIndex ].referenceCount );
}
textureId = mTextureInfoContainer[ cacheIndex ].textureId;
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) Using cached texture id@%d, textureId=%d\n",
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, "TextureManager::RequestLoad( url=%s observer=%p ) Using cached texture id@%d, textureId=%d\n",
url.GetUrl().c_str(), observer, cacheIndex, textureId );
}
preMultiply ) );
cacheIndex = mTextureInfoContainer.size() - 1u;
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d\n",
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d\n",
url.GetUrl().c_str(), observer, cacheIndex, textureId );
}
textureInfo.storageType = storageType;
textureInfo.orientationCorrection = orientationCorrection;
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureInfo loadState:%s\n",
- textureInfo.loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" :
- textureInfo.loadState == TextureManager::LOADING ? "LOADING" :
- textureInfo.loadState == TextureManager::UPLOADED ? "UPLOADED" :
- textureInfo.loadState == TextureManager::CANCELLED ? "CANCELLED" : "Unknown" );
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, "TextureInfo loadState:%s\n",
+ GET_LOAD_STATE_STRING(textureInfo.loadState ) );
// Force reloading of texture by setting loadState unless already loading or cancelled.
if ( TextureManager::ReloadPolicy::FORCED == reloadPolicy && TextureManager::LOADING != textureInfo.loadState &&
case TextureManager::LOAD_FAILED: // Failed notifies observer which then stops observing.
case TextureManager::NOT_STARTED:
{
- LoadTexture( textureInfo );
- ObserveTexture( textureInfo, observer );
+ LoadOrQueueTexture( textureInfo, observer ); // If called inside NotifyObservers, queues until afterwards
break;
}
case TextureManager::LOADING:
{
if( observer )
{
- // The Texture has already loaded. The other observers have already been notified.
- // We need to send a "late" loaded notification for this observer.
- observer->UploadComplete( true, textureInfo.textureId, textureInfo.textureSet,
- textureInfo.useAtlas, textureInfo.atlasRect,
- textureInfo.preMultiplied );
+ LoadOrQueueTexture( textureInfo, observer );
}
break;
}
{
TextureInfo& textureInfo( mTextureInfoContainer[ textureInfoIndex ] );
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::Remove(%d) cacheIdx:%d loadState:%s\n",
- textureId, textureInfoIndex,
- textureInfo.loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" :
- textureInfo.loadState == TextureManager::LOADING ? "LOADING" :
- textureInfo.loadState == TextureManager::UPLOADED ? "UPLOADED" :
- textureInfo.loadState == TextureManager::CANCELLED ? "CANCELLED" : "Unknown" );
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise,
+ "TextureManager::Remove(%d) url:%s\n cacheIdx:%d loadState:%s\n",
+ textureId, textureInfo.url.GetUrl().c_str(),
+ textureInfoIndex, GET_LOAD_STATE_STRING( textureInfo.loadState ) );
// Decrement the reference count and check if this is the last user of this Texture.
if( --textureInfo.referenceCount <= 0 )
DALI_ASSERT_DEBUG(endIter != mLifecycleObservers.End());
}
+void TextureManager::LoadOrQueueTexture( TextureInfo& textureInfo, TextureUploadObserver* observer )
+{
+ switch( textureInfo.loadState )
+ {
+ case NOT_STARTED:
+ case LOAD_FAILED:
+ {
+ if( mQueueLoadFlag )
+ {
+ QueueLoadTexture( textureInfo, observer );
+ }
+ else
+ {
+ LoadTexture( textureInfo, observer );
+ }
+ break;
+ }
+ case LOADING:
+ case UPLOADED:
+ {
+ if( mQueueLoadFlag )
+ {
+ QueueLoadTexture( textureInfo, observer );
+ }
+ else
+ {
+ // The Texture has already loaded. The other observers have already been notified.
+ // We need to send a "late" loaded notification for this observer.
+ observer->UploadComplete( true, textureInfo.textureId, textureInfo.textureSet,
+ textureInfo.useAtlas, textureInfo.atlasRect,
+ textureInfo.preMultiplied );
+ }
+ }
+ case CANCELLED:
+ case LOAD_FINISHED:
+ case WAITING_FOR_MASK:
+ {
+ break;
+ }
+ }
+}
+
+void TextureManager::QueueLoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer )
+{
+ auto textureId = textureInfo.textureId;
+ mLoadQueue.PushBack( LoadQueueElement( textureId, observer) );
+}
-bool TextureManager::LoadTexture( TextureInfo& textureInfo )
+void TextureManager::LoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer )
{
- bool success = true;
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::LoadTexture(): url:%s sync:%s\n",
+ textureInfo.url.GetUrl().c_str(), textureInfo.loadSynchronously?"T":"F" );
- if( textureInfo.loadState == NOT_STARTED )
+ textureInfo.loadState = LOADING;
+ if( !textureInfo.loadSynchronously )
{
- textureInfo.loadState = LOADING;
+ auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders;
+ auto loadingHelperIt = loadersContainer.GetNext();
+ DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End());
+ loadingHelperIt->Load(textureInfo.textureId, textureInfo.url,
+ textureInfo.desiredSize, textureInfo.fittingMode,
+ textureInfo.samplingMode, textureInfo.orientationCorrection );
+ }
+ ObserveTexture( textureInfo, observer );
+}
- if( !textureInfo.loadSynchronously )
+void TextureManager::ProcessQueuedTextures()
+{
+ for( auto&& element : mLoadQueue )
+ {
+ int cacheIndex = GetCacheIndexFromId( element.mTextureId );
+ if( cacheIndex != INVALID_CACHE_INDEX )
{
- auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders;
- auto loadingHelperIt = loadersContainer.GetNext();
- DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End());
- loadingHelperIt->Load(textureInfo.textureId, textureInfo.url,
- textureInfo.desiredSize, textureInfo.fittingMode,
- textureInfo.samplingMode, textureInfo.orientationCorrection );
+ TextureInfo& textureInfo( mTextureInfoContainer[cacheIndex] );
+ if( textureInfo.loadState == UPLOADED )
+ {
+ element.mObserver->UploadComplete( true, textureInfo.textureId, textureInfo.textureSet,
+ textureInfo.useAtlas, textureInfo.atlasRect,
+ textureInfo.preMultiplied );
+ }
+ else
+ {
+ LoadTexture( textureInfo, element.mObserver );
+ }
}
}
-
- return success;
+ mLoadQueue.Clear();
}
void TextureManager::ObserveTexture( TextureInfo& textureInfo,
TextureUploadObserver* observer )
{
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::ObserveTexture(): url:%s observer:%p\n",
+ textureInfo.url.GetUrl().c_str(), observer );
+
if( observer )
{
textureInfo.observerList.PushBack( observer );
{
TextureInfo& textureInfo( mTextureInfoContainer[cacheIndex] );
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, " CacheIndex:%d LoadState: %d\n", cacheIndex, textureInfo.loadState );
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise,
+ " textureId:%d Url:%s CacheIndex:%d LoadState: %d\n",
+ textureInfo.textureId, textureInfo.url.GetUrl().c_str(), cacheIndex, textureInfo.loadState );
if( textureInfo.loadState != CANCELLED )
{
}
}
-
void TextureManager::UploadTexture( Devel::PixelBuffer& pixelBuffer, TextureInfo& textureInfo )
{
if( textureInfo.useAtlas != USE_ATLAS )
{
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, " TextureManager::UploadTexture() New Texture for textureId:%d\n", textureInfo.textureId );
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, " TextureManager::UploadTexture() New Texture for textureId:%d\n", textureInfo.textureId );
// If the texture doesn't have an alpha channel, can't pre-multiply it.
// Ensure that we don't change the load parameter (it's used for hashing), and instead set
// If there is an observer: Notify the load is complete, whether successful or not,
// and erase it from the list
- unsigned int observerCount = textureInfo.observerList.Count();
TextureInfo* info = &textureInfo;
- while( observerCount )
+ mQueueLoadFlag = true;
+
+ while( info->observerList.Count() )
{
TextureUploadObserver* observer = info->observerList[0];
// During UploadComplete() a Control ResourceReady() signal is emitted.
// During that signal the app may add remove /add Textures (e.g. via
- // ImageViews). At this point no more observers can be added to the
- // observerList, because textureInfo.loadState = UPLOADED. However it is
- // possible for observers to be removed, hence we check the observer list
- // count every iteration.
-
- // The reference to the textureInfo struct can also become invalidated,
- // because new load requests can modify the mTextureInfoContainer list
- // (e.g. if more requests are pushed back it can cause the list to be
- // resized invalidating the reference to the TextureInfo ).
+ // ImageViews).
+ // It is possible for observers to be removed from the observer list,
+ // and it is also possible for the mTextureInfoContainer to be modified,
+ // invalidating the reference to the textureInfo struct.
+ // Texture load requests for the same URL are deferred until the end of this
+ // method.
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "NotifyObservers() url:%s loadState:%s\n",
+ textureInfo.url.GetUrl().c_str(), GET_LOAD_STATE_STRING(textureInfo.loadState ) );
+
observer->UploadComplete( success, info->textureId, info->textureSet, info->useAtlas, info->atlasRect,
info->preMultiplied );
observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
- // Get the textureInfo from the container again as it may have been
- // invalidated,
-
+ // Get the textureInfo from the container again as it may have been invalidated.
int textureInfoIndex = GetCacheIndexFromId( textureId );
if( textureInfoIndex == INVALID_CACHE_INDEX)
{
- return; // texture has been removed - can stop.
+ break; // texture has been removed - can stop.
}
-
info = &mTextureInfoContainer[ textureInfoIndex ];
- observerCount = info->observerList.Count();
- if ( observerCount > 0 )
+
+ // remove the observer that was just triggered if it's still in the list
+ for( TextureInfo::ObserverListType::Iterator j = info->observerList.Begin(); j != info->observerList.End(); ++j )
{
- // remove the observer that was just triggered if it's still in the list
- for( TextureInfo::ObserverListType::Iterator j = info->observerList.Begin(); j != info->observerList.End(); ++j )
+ if( *j == observer )
{
- if( *j == observer )
- {
- info->observerList.Erase( j );
- observerCount--;
- break;
- }
+ info->observerList.Erase( j );
+ break;
}
}
}
+
+ mQueueLoadFlag = false;
+ ProcessQueuedTextures();
}
TextureManager::TextureId TextureManager::GenerateUniqueTextureId()
typedef size_t TextureHash; ///< The type used to store the hash used for Texture caching.
+ // Structs:
+
/**
* @brief This struct is used to manage the life-cycle of Texture loading and caching.
*/
bool preMultiplied:1; ///< true if the image's color was multiplied by it's alpha
};
- // Structs:
+ /**
+ * Structure to hold info about a texture load queued during NotifyObservers
+ */
+ struct LoadQueueElement
+ {
+ LoadQueueElement( TextureId textureId, TextureUploadObserver* observer )
+ : mTextureId( textureId ),
+ mObserver( observer )
+ {
+ }
+
+ TextureId mTextureId; ///< The texture id of the requested load.
+ TextureUploadObserver* mObserver; ///< Observer of texture load.
+ };
/**
* Struct to hold information about a requested Async load.
typedef std::vector<TextureInfo> TextureInfoContainerType; ///< The container type used to manage the life-cycle and caching of Textures
/**
+ * @brief Initiate a load or queue load if NotifyObservers is invoking callbacks
+ * @param[in] textureInfo The TextureInfo struct associated with the Texture
+ * @param[in] observer The observer wishing to observe the texture upload
+ */
+ void LoadOrQueueTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+
+ /**
+ * @brief Queue a texture load to be subsequently handled by ProcessQueuedTextures.
+ * @param[in] textureInfo The TextureInfo struct associated with the Texture
+ * @param[in] observer The observer wishing to observe the texture upload
+ */
+ void QueueLoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+
+ /**
* @brief Used internally to initiate a load.
* @param[in] textureInfo The TextureInfo struct associated with the Texture
- * @return True if the load was initiated
+ * @param[in] observer The observer wishing to observe the texture upload
+ */
+ void LoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+
+ /**
+ * @brief Initiate load of textures queued whilst NotifyObservers invoking callbacks.
*/
- bool LoadTexture( TextureInfo& textureInfo );
+ void ProcessQueuedTextures();
/**
* Add the observer to the observer list
* @param[in] textureInfo The TextureInfo struct associated with the texture
- * observer The observer wishing to observe the texture upload
+ * @param[in] observer The observer wishing to observe the texture upload
*/
void ObserveTexture( TextureInfo & textureInfo, TextureUploadObserver* observer );
RoundRobinContainerView< AsyncLoadingHelper > mAsyncRemoteLoaders; ///< The Asynchronous image loaders used to provide all remote async loads
std::vector< ExternalTextureInfo > mExternalTextures; ///< Externally provided textures
Dali::Vector<LifecycleObserver*> mLifecycleObservers; ///< Lifecycle observers of texture manager
+ Dali::Vector<LoadQueueElement> mLoadQueue; ///< Queue of textures to load after NotifyObservers
std::string mBrokenImageUrl; ///< Broken image url
TextureId mCurrentTextureId; ///< The current value used for the unique Texture Id generation
+ bool mQueueLoadFlag; ///< Flag that causes Load Textures to be queued.
};
namespace
{
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CONTROL_VISUALS");
+#endif
+
BaseHandle Create()
{
BaseHandle handle = Toolkit::VisualFactory::Get();
}
}
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "VisualFactory::CreateVisual( VisualType:%s %s%s)\n",
+ Scripting::GetEnumerationName<Toolkit::DevelVisual::Type>( visualType,
+ VISUAL_TYPE_TABLE,
+ VISUAL_TYPE_TABLE_COUNT ),
+ visualType==Toolkit::DevelVisual::IMAGE?"url:":"",
+ visualType==Toolkit::DevelVisual::IMAGE ?
+ propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME)->Get<std::string>().c_str()
+ :"" );
+
+
if( !visualPtr )
{
- DALI_LOG_ERROR( "Renderer type unknown\n" );
+ DALI_LOG_ERROR( "VisualType unknown\n" );
}
if( mDebugEnabled && visualType != Toolkit::DevelVisual::WIREFRAME )
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 4;
-const unsigned int TOOLKIT_MICRO_VERSION = 5;
+const unsigned int TOOLKIT_MICRO_VERSION = 6;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.4.5
+Version: 1.4.6
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT