Svace errors in Grid layout
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / utc-Dali-TextureManager.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19
20 #include <stdlib.h>
21
22 #include <dali-toolkit-test-suite-utils.h>
23 #include <dali-toolkit/internal/visuals/texture-manager-impl.h>
24 #include <dali-toolkit/internal/visuals/texture-upload-observer.h>
25
26 using namespace Dali::Toolkit::Internal;
27
28 class TestObserver : public Dali::Toolkit::TextureUploadObserver
29 {
30 public:
31   TestObserver()
32   : mLoaded(false),
33     mObserverCalled(false)
34   {
35   }
36
37   virtual void UploadComplete( bool loadSuccess, int32_t textureId, TextureSet textureSet,
38                                bool useAtlasing, const Vector4& atlasRect, bool preMultiplied ) override
39   {
40     mLoaded = loadSuccess;
41     mObserverCalled = true;
42   }
43
44   bool mLoaded;
45   bool mObserverCalled;
46 };
47
48
49 int UtcTextureManagerRequestLoad(void)
50 {
51   ToolkitTestApplication application;
52
53   TextureManager textureManager; // Create new texture manager
54
55   TestObserver observer;
56   std::string filename("image.png");
57   auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
58   TextureManager::TextureId textureId = textureManager.RequestLoad(
59     filename,
60     ImageDimensions(),
61     FittingMode::SCALE_TO_FILL,
62     SamplingMode::BOX_THEN_LINEAR,
63     TextureManager::NO_ATLAS,
64     &observer,
65     true,
66     TextureManager::ReloadPolicy::CACHED,
67     preMultiply);
68
69   VisualUrl url = textureManager.GetVisualUrl( textureId );
70
71   DALI_TEST_EQUALS( url.GetUrl().compare( filename ), 0, TEST_LOCATION );
72
73   END_TEST;
74 }